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)
commitd92350878221f10923fe1572ba5192b67a19c8de
tree7713fcc6301992a2b47b7496fc780d11261e54dc
parent225262562f803997496b394e3b69714cc9ac7dd8
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

llvm-svn: 237051
llvm/tools/llvm-as/llvm-as.cpp
llvm/tools/llvm-dis/llvm-dis.cpp