[LLVMbugs] [Bug 15927] New: YAML IO crashes in Input::beginMapping() when trying to read from an empty string

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 7 09:48:51 PDT 2013


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: unassignedbugs at nondot.org
          Reporter: alexfh at google.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130507/0134c89f/attachment.html>


More information about the llvm-bugs mailing list