Fix input validation issues in llvm-as/llvm-dis
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 11 May 2015 21:20:20 +0000 (21:20 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 11 May 2015 21:20:20 +0000 (21:20 +0000)
commit4e5be5af59f02cafac328ef644ca13d526d1dcb4
tree4c8d9c81023b27ea349513e326170c7fcd993048
parent051ef86497b5c292465101af684d5d0708cc37bc
Fix input validation issues in llvm-as/llvm-dis

Summary:
1. llvm-as/llvm-dis tools do not check for input filename length.
2. llvm-dis does not verify the `Streamer` variable against `nullptr` properly, so the `M` variable could be uninitialized (e.g. if the input file does not exist) leading to null dref.

Patch by Lenar Safin!

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

Differential Revision: http://reviews.llvm.org/D9584

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237051 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-as/llvm-as.cpp
tools/llvm-dis/llvm-dis.cpp