[llvm] r203745 - MC: fix possible NULL pointer dereference

Saleem Abdulrasool compnerd at compnerd.org
Mon Mar 17 10:08:09 PDT 2014


On Sun, Mar 16, 2014 at 5:53 PM, David Blaikie <dblaikie at gmail.com> wrote:

> On Sun, Mar 16, 2014 at 5:37 PM, Saleem Abdulrasool
> <compnerd at compnerd.org> wrote:
> > On Thu, Mar 13, 2014 at 8:38 AM, David Blaikie <dblaikie at gmail.com>
> wrote:
> >>
> >> On Wed, Mar 12, 2014 at 7:09 PM, Saleem Abdulrasool
> >> <compnerd at compnerd.org> wrote:
> >> > Author: compnerd
> >> > Date: Wed Mar 12 21:09:51 2014
> >> > New Revision: 203745
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=203745&view=rev
> >> > Log:
> >> > MC: fix possible NULL pointer dereference
> >> >
> >> > Avoid NULL pointer scenario found via clang's static analyzer.
> >>
> >> Any chance of a test case? If you replace the check with an assert
> >> does any easily accessible code (such as a Clang/LLVM bootstrap) fail?
> >> & a test case could be reduced from there.
> >
> >
> > Unfortunately, I couldnt find any easily accessible code failure for this
> > scenario.
>
> Could we just replace this with an assert, then? (& eventually if we
> find a buildbot/user/etc that fails we'll be able to add the right
> test case) Or is there good reason to believe this might be null in an
> obscure case?


Yeah, I was torn on this myself.  I figured that erring on the side of
caution was reasonable.  But, if someone else independently also thinks
that this is reasonable as an assert, its good enough for me.

Ill change it to an assert shortly.


> >
> >>
> >> >
> >> > Modified:
> >> >     llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> >> >
> >> > Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> >> > URL:
> >> >
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=203745&r1=203744&r2=203745&view=diff
> >> >
> >> >
> ==============================================================================
> >> > --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
> >> > +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Wed Mar 12 21:09:51 2014
> >> > @@ -2005,7 +2005,7 @@ bool AsmParser::parseMacroArguments(cons
> >> >        if (FAI >= NParameters) {
> >> >          Error(IDLoc,
> >> >                "parameter named '" + FA.Name + "' does not exist for
> >> > macro '" +
> >> > -              M->Name + "'");
> >> > +              (M ? M->Name : "<unamed>") + "'");
> >> >          return true;
> >> >        }
> >> >        PI = FAI;
> >> >
> >> >
> >> > _______________________________________________
> >> > llvm-commits mailing list
> >> > llvm-commits at cs.uiuc.edu
> >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> >
> > --
> > Saleem Abdulrasool
> > compnerd (at) compnerd (dot) org
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140317/5d027ca6/attachment.html>


More information about the llvm-commits mailing list