summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cfdf_document.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-04 11:02:59 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-04 11:02:59 -0700
commit761eed284e1248f851fbb23beaa45835b644ecee (patch)
tree34cff2bb264236174957fb0b7fc7a8c3c1f26e30 /core/fpdfapi/parser/cfdf_document.cpp
parentf0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3 (diff)
downloadpdfium-761eed284e1248f851fbb23beaa45835b644ecee.tar.xz
Assert objnum non-zero in ReplaceIndirectObjectIfHigherGeneration()
Removes a path where it might not have taken ownership of an object, at the expense of making callers check first. This eases making the second argument an unique_ptr someday. Review-Url: https://codereview.chromium.org/2475823002
Diffstat (limited to 'core/fpdfapi/parser/cfdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index d39ec31d3c..bcaa9daec3 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -58,6 +58,9 @@ void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) {
CFX_ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
uint32_t objnum = FXSYS_atoui(word.c_str());
+ if (!objnum)
+ break;
+
word = parser.GetNextWord(&bNumber);
if (!bNumber)
break;