<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - YAML IO crashes in Input::beginMapping() when trying to read from an empty string"
   href="http://llvm.org/bugs/show_bug.cgi?id=15927">15927</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>YAML IO crashes in Input::beginMapping() when trying to read from an empty string
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alexfh@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The code to reproduce this is:
#include "llvm/Support/YAMLTraits.h"
struct T { int a; };

namespace llvm {
namespace yaml {
template <> struct MappingTraits<T> {
  static void mapping(llvm::yaml::IO &IO, T &T) {
    IO.mapOptional("a", T.a);
  }
};
}
}

int main(int argc, const char **argv) {
  llvm::yaml::Input Input("");
  T T;
  Input >> T;
  return 0;
}

-----------------
$ ./test
test: llvm/include/llvm/Support/Casting.h:97: static bool
llvm::isa_impl_cl<llvm::yaml::Input::MapHNode, const llvm::yaml::Input::HNode
*>::doit(const From *) [To = llvm::yaml::Input::MapHNode, From = const
llvm::yaml::Input::HNode *]: Assertion `Val && "isa<> used on a null pointer"'
failed.
Aborted (core dumped)

The problem is in the line 88 of lib/Support/YAMLTraits.cpp:
88   MapHNode *MN = dyn_cast<MapHNode>(CurrentNode);</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>