tools: address possible non-null terminated filenames
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 14 Apr 2014 02:37:23 +0000 (02:37 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 14 Apr 2014 02:37:23 +0000 (02:37 +0000)
commit67635a7f8df47fa7eb9d7a437ee93f3037e67869
tree0a84bfd2bfbd16fcb897ae7bf37855c11012f3b8
parentaa827a513cb8b8bb15c2bcbda0617d665c4d8116
tools: address possible non-null terminated filenames

If a filename is a multiple of 18 characters, there will be no null-terminator.
This will result in an invalid access by the constructed StringRef.  Add a test
case to exercise this and fix that handling.  Address this same vulnerability in
llvm-readobj as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206145 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objdump/Inputs/file-aux-record.yaml [new file with mode: 0644]
test/tools/llvm-objdump/coff-non-null-terminated-file.test [new file with mode: 0644]
test/tools/llvm-readobj/Inputs/file-aux-record.yaml [new file with mode: 0644]
test/tools/llvm-readobj/coff-non-null-terminated-file.test [new file with mode: 0644]
tools/llvm-objdump/llvm-objdump.cpp
tools/llvm-readobj/COFFDumper.cpp