New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/finding null pointer #235
Conversation
14587e6
to
bb43b1a
Compare
| @@ -1018,7 +1018,13 @@ EStatusCode CFFFileInput::CalculateDependenciesForCharIndex(unsigned short inFon | |||
| if(status != PDFHummus::eFailure) | |||
| { | |||
| mCurrentDependencies = &ioDependenciesInfo; | |||
| return interpreter.Intepret(*GetGlyphCharString(inFontIndex,inCharStringIndex),this); | |||
| CharString* charString = GetGlyphCharString(inFontIndex,inCharStringIndex); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs indentation
|
|
||
| if (!lowerLeftX || !lowerLeftY || !upperRightX || !upperRightY) | ||
| { | ||
| // not sure if just a return is a good idea here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well its all in teh unexpected area so any decision is good.
Inspecting all usages there's a pattern of checking for an array, then if it's 4 and then either going for a default or calling SetPDFRectangleFromArray.
so that array check+ 4 check can be moved into SetPDFRectangleFromArray for better reuse and that it'd return status. then it's `if(SetPDFRectangleFromArray(....) == eFailure) do_the_default.
| @@ -396,6 +396,12 @@ EStatusCode PDFParser::ParseLastXrefPosition() | |||
| while(!foundStartXref && mStream->NotEnded()) | |||
| { | |||
| PDFObjectCastPtr<PDFSymbol> startxRef(mObjectParser.ParseNewObject()); | |||
| if(!startxRef) | |||
| { | |||
| status = PDFHummus::eFailure; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
|
@mhassan1 if you got some time i could need your pair of eyes here. |
|
At first glance, all these changes look fine to me. Questions:
|
bb43b1a
to
6ce0623
Compare
|
@galkahana i took a deeper look and found again some situation where it might not end well |
Thanks. Will check on my end |
|
@julianhille somebody submitted this issue once with the results of running fuzztest on a pdf text extractor i wrote on top of hummus, might be worthwhile input for more debuggging if you wish it: |
|
Awesome. Thanks. |
|
@mhassan1 @galkahana i found more and created security private fork i would add you if you dont mind just do not accept if you dont want to take part, ok? |
| @@ -2176,7 +2176,7 @@ EStatusCode DocumentContext::SetupModifiedFile(PDFParser* inModifiedFileParser) | |||
| if(idArray.GetPtr() && idArray->GetLength() == 2) | |||
| { | |||
| PDFObjectCastPtr<PDFHexString> firstID = idArray->QueryObject(0); | |||
| if(firstID.GetPtr()) | |||
| if(firstID != NULL && firstID.GetPtr()) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verifying: is the null check really needed here? won't GetPtr() be falsy in this case?
No description provided.