Direct-leak in CJBig2_Image::subImage |
|||||||
Issue descriptionDetailed report: https://cluster-fuzz.appspot.com/testcase?key=6645639570259968 Fuzzer: libfuzzer_pdf_codec_jbig2_fuzzer Job Type: libfuzzer_chrome_asan Platform Id: linux Crash Type: Direct-leak Crash Address: Crash State: CJBig2_Image::subImage CJBig2_SDDProc::decode_Huffman CJBig2_Context::parseSymbolDict Regressed: https://cluster-fuzz.appspot.com/revisions?job=libfuzzer_chrome_asan&range=424084:424087 Minimized Testcase (0.05 Kb): https://cluster-fuzz.appspot.com/download/AMIfv94ytpm9CilAFgTTPmOun4vDDERDWBmrXtDdqzZZ3AMII6-gjUfHn-zR29RSz-icg76nHdC1BNabb5LIY9D8_hXEpZZtVtdlnAv1EO6D4K2dDkpsAkBh2WDf8GL4hWIj5VuW4H1-gHaEJNljK5HzthENJBatcA?testcase_id=6645639570259968 Issue manually filed by: nyerramilli See https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reproducing.md for more information.
,
Oct 12 2016
,
Oct 12 2016
I found "SDNUMEXSYMS" is never assigned. https://cs.chromium.org/search/?q=SDNUMEXSYMS&sq=package:chromium&type=cs Thus line 577 is always false https://cs.chromium.org/chromium/src/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp?q=SDNUMEXSYMS&sq=package:chromium&l=577&dr=C if (EXFLAGS[I] && J < SDNUMEXSYMS) { in other words, it will leak memory if EXFLAGS[I] is true. p.s. line 255 has code with similar structure. https://cs.chromium.org/chromium/src/third_party/pdfium/core/fxcodec/jbig2/JBig2_SddProc.cpp?q=SDNUMEXSYMS&sq=package:chromium&l=255&dr=C
,
Oct 12 2016
It looks like the code fails to cleanup the SDNEWSYMS array correctly. In jBig2_SddProc.cpp we allocate a number of BHC->subImage's and put them into SDNEWSYMS. In this case we create 20 subimages. We then set EXFLAGS to true for images 0-1, 11-19. We then either add the image to pDict for free it. But we only free it if EXFLAGS is not true. So, we fail to free the 11 subimages we'd set EXFLAGS to true for. I don't know what EXFLAGS means, or why we'd set it for those particular images.
,
Oct 12 2016
,
Oct 12 2016
,
Oct 12 2016
Many of the VARIABLENAMES are directly from the JBIG2 spec, which describes the procedures PDFium implements. As with many specs, the spec does not deal with the corner cases.
,
Oct 12 2016
Isn't SDNUMEXSYMS assigned on line 450 of JBig2_Context.cpp?
,
Oct 12 2016
Ah, you are right.
,
Oct 13 2016
The following revision refers to this bug: https://pdfium.googlesource.com/pdfium.git/+/6e5239c6e3891d78e7b9e8262c23cd129f0cdbb7 commit 6e5239c6e3891d78e7b9e8262c23cd129f0cdbb7 Author: dsinclair <dsinclair@chromium.org> Date: Thu Oct 13 14:54:09 2016 Verify number of ex flags matches number of ex items. Currently the JBig2 decoder can leak subimages in the case where we mark more items in EXFLAGS then we have SDNUMEXSYMS. This Cl checks for this condition and fails the decode if it happens. BUG= chromium:654365 Review-Url: https://codereview.chromium.org/2419553002 [modify] https://crrev.com/6e5239c6e3891d78e7b9e8262c23cd129f0cdbb7/core/fxcodec/jbig2/JBig2_SddProc.cpp
,
Oct 13 2016
,
Oct 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7f9206f34e7fba79d9b5ba24647f32e5c0431cfa commit 7f9206f34e7fba79d9b5ba24647f32e5c0431cfa Author: pdfium-deps-roller <pdfium-deps-roller@chromium.org> Date: Thu Oct 13 15:56:21 2016 Roll src/third_party/pdfium/ f2b940ce2..6e5239c6e (2 commits). https://pdfium.googlesource.com/pdfium.git/+log/f2b940ce281a..6e5239c6e389 $ git log f2b940ce2..6e5239c6e --date=short --no-merges --format='%ad %ae %s' 2016-10-13 dsinclair Verify number of ex flags matches number of ex items. 2016-10-13 dsinclair Cleanup CPDFXFA_App methods BUG= 654365 TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2416933002 Cr-Commit-Position: refs/heads/master@{#425047} [modify] https://crrev.com/7f9206f34e7fba79d9b5ba24647f32e5c0431cfa/DEPS
,
Oct 18 2016
,
Nov 22 2016
Removing EditIssue view restrictions from ClusterFuzz filed bugs. If you believe that this issue should still be restricted, please reapply the label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by nyerramilli@chromium.org
, Oct 10 2016Components: Tools>Test>FindIt>WrongResult Internals>Plugins>PDF
Labels: findit-wrong Te-Logged
Owner: dsinclair@chromium.org
Status: Assigned (was: Untriaged)