http://llvm.org/bugs/show_bug.cgi?id=15927

            Bug ID: 15927
           Summary: YAML IO crashes in Input::beginMapping() when trying
                    to read from an empty string
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to