LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 16221 - clang-format specifying invalid yaml as -style input crashes the yaml parser
Summary: clang-format specifying invalid yaml as -style input crashes the yaml parser
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-04 10:03 PDT by Ola Nilsson
Modified: 2013-11-18 09:51 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ola Nilsson 2013-06-04 10:03:59 PDT
Built from svn revision 183220.

Reproduce + info:

[ola@ellen build]$ gdb ./Debug+Asserts/bin/clang-format
run -style="{BasedOnStyle:llvm}" ../tools/clang/tools/clang-format/ClangFormat.cpp
Starting program: /home/ola/src/llvm-trunk/build/Debug+Asserts/bin/clang-format -style="{BasedOnStyle:llvm}" ../tools/clang/tools/clang-format/ClangFormat.cpp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
YAML:1:14: error: Found unexpected ':' while scanning a plain scalar
{BasedOnStyle:llvm}
             ^
clang-format: /home/ola/src/llvm-trunk/include/llvm/Support/Casting.h:97: static bool llvm::isa_impl_cl<llvm::yaml::NullNode, const llvm::yaml::Node *>::doit(const From *) [To = llvm::yaml::NullNode, From = const llvm::yaml::Node *]: Assertion `Val && "isa<> used on a null pointer"' failed.

Program received signal SIGABRT, Aborted.
0x0000003b1c2328a5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003b1c2328a5 in raise () from /lib64/libc.so.6
#1  0x0000003b1c234085 in abort () from /lib64/libc.so.6
#2  0x0000003b1c22ba1e in __assert_fail_base () from /lib64/libc.so.6
#3  0x0000003b1c22bae0 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000011e6a3e in llvm::isa_impl_cl<llvm::yaml::NullNode, llvm::yaml::Node const*>::doit (Val=0x0) at /home/ola/src/llvm-trunk/include/llvm/Support/Casting.h:97
#5  0x00000000011e69e8 in llvm::isa_impl_wrap<llvm::yaml::NullNode, llvm::yaml::Node const*, llvm::yaml::Node const*>::doit (Val=@0x7fffffffc840: 0x0) at /home/ola/src/llvm-trunk/include/llvm/Support/Casting.h:124
#6  0x00000000011e69c2 in llvm::isa_impl_wrap<llvm::yaml::NullNode, llvm::yaml::Node* const, llvm::yaml::Node const*>::doit (Val=@0x7fffffffc8a0: 0x0) at /home/ola/src/llvm-trunk/include/llvm/Support/Casting.h:116
#7  0x00000000011e2d55 in llvm::isa<llvm::yaml::NullNode, llvm::yaml::Node*> (Val=@0x7fffffffc8a0: 0x0) at /home/ola/src/llvm-trunk/include/llvm/Support/Casting.h:135
#8  0x00000000011df568 in llvm::yaml::Input::setCurrentDocument (this=0x7fffffffc940) at /home/ola/src/llvm-trunk/lib/Support/YAMLTraits.cpp:69
#9  0x00000000004128f9 in llvm::yaml::operator>><clang::format::FormatStyle> (yin=..., docMap=...) at /home/ola/src/llvm-trunk/include/llvm/Support/YAMLTraits.h:959
#10 0x0000000000411fee in clang::format::parseConfiguration (Text=..., Style=0x7fffffffd1a8) at /home/ola/src/llvm-trunk/tools/clang/lib/Format/Format.cpp:214
#11 0x0000000000406389 in clang::format::getStyle (StyleName=..., FileName=...) at /home/ola/src/llvm-trunk/tools/clang/tools/clang-format/ClangFormat.cpp:107
Python Exception <class 'gdb.error'> No type named std::basic_string<char>::_Rep.:
#12 0x0000000000407926 in clang::format::format (FileName=) at /home/ola/src/llvm-trunk/tools/clang/tools/clang-format/ClangFormat.cpp:199
#13 0x0000000000406f94 in main (argc=3, argv=0x7fffffffdea8) at /home/ola/src/llvm-trunk/tools/clang/tools/clang-format/ClangFormat.cpp:279
Comment 1 Alexander Kornienko 2013-11-18 09:51:22 PST
Fixed in r195016.