summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2
AgeCommit message (Collapse)Author
2018-08-02Tidy JBig2_Image.cppchromium/3511Tom Sepez
Add checked/unchecked GetLine(y) methods and use them. Introduce BIT_INDEX_TO_ALIGNED_BYTE() to de-mystify some shifting. Move local declarations to spot of use. Remove spurious Fill(), as we initialize to 0s. Initialize members in header where possible. Add unit tests. Change-Id: I41ccb91b57320dbc790fd0f680f6d98571280343 Reviewed-on: https://pdfium-review.googlesource.com/39370 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-02Introduce JBIG2_PUTDWORD() macro in CJBIG2_Image.hTom Sepez
Provide symmetry with JBIG2_GETDWORD(). Avoid potential illegal undefined signed shift in JBIG2_GETDWORD(). Get better column alignment under cl-format via pointless shift by zeros for consistency. Change-Id: I13d46fe7976074e26df72b58a055788390191364 Reviewed-on: https://pdfium-review.googlesource.com/39430 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-01Bounds check lineSrc in JBig2_Image.cpp.Tom Sepez
No matter how the dimensions might be determined, we know the hard end of the source line, and can use it for a bounds check. We expect the size is quantized to a multiple of m_stride, so as long as each block operates within an m_stride, the initial check should be sufficient. Bug: 867501 Change-Id: Iaf9936557b856f3eb09fef522f3e6738aa4f38f0 Reviewed-on: https://pdfium-review.googlesource.com/39310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-27Merge several methods into JBig2GrdProc::DecodeArithTemplateUnoptchromium/3505Nicolas Pena
This CL merges DecodeArithTemplateXUnopt for X=0,1,2. This is similar to how three methods were merged into DecodeArithOpt3. Change-Id: Ib0d4f14de6a8c924517d82eaec7577961503a325 Reviewed-on: https://pdfium-review.googlesource.com/38935 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-06Fix regression in CJBig2_TRDProc.chromium/3486chromium/3485chromium/3484Lei Zhang
Commit 7695dd0f mistakenly changed a signed integer to unsigned. This is incorrect because right shifts for negative integers behave differently. BUG=chromium:859284 Change-Id: Id9c54848b15ace1de080c174f261dd2c064018e0 Reviewed-on: https://pdfium-review.googlesource.com/37230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-02Check for more integer overflows in CJBig2_TRDProc.Lei Zhang
BUG=chromium:859284 Change-Id: I41ce5de4cca0a863dc6e60b64fd69d36c2672a64 Reviewed-on: https://pdfium-review.googlesource.com/36790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-29Limit image size in CJBig2_PDDProc.Lei Zhang
CJBig2_PDDProc internally creates a CJBig2_GRDProc to create an image. If the image is too big, then processing it can use up too much memory. BUG=chromium:857106 Change-Id: I06a9eaed6941be1cbb7481d21048e6a1681696b7 Reviewed-on: https://pdfium-review.googlesource.com/36490 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-29Clean up CJBig2_PDDProc.Lei Zhang
Change-Id: Ia83ac5dae0dedf55f1b0f0cf2a728c64474f72db Reviewed-on: https://pdfium-review.googlesource.com/36450 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-14Merge 3 methods of CJBig2_GRDProc togetherchromium/3465chromium/3464chromium/3463chromium/3462chromium/3461Nicolas Pena
This CL merges 3 methods into a single DecodeArithOpt3(). The code is the same, except for some constants which are extracted out as namespace variables. Change-Id: I6d9127d71b5e7c4c75e31a736b0f3307bb78a076 Reviewed-on: https://pdfium-review.googlesource.com/35170 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-06-13Make CJBig2_Context::GetHuffmanTable return constNicolas Pena
This CL changes GetHuffmanTable() to return a const pointer and fixes other members / functions accordingly. Change-Id: Ie62fe044b3156f67885dd4fa1f6512cbd35a83d3 Reviewed-on: https://pdfium-review.googlesource.com/35116 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-24Do some variable cleanup in CJBig2_ContextNicolas Pena
This CL cleans up variables in CJBig2_Context. It moves some declarations further, to when the variables are actually used. It also caches huffman tables in a vector of unique_ptr. Change-Id: Id3af96f9526b1000f681e4e2b174bba07b45ee55 Reviewed-on: https://pdfium-review.googlesource.com/32715 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-22Remove JBIG2_memcpy() and JBIG2_memset().Lei Zhang
Just use memcpy() and memset(). Change-Id: Id6c6fab4e65a5524786ae318270c5981313825f2 Reviewed-on: https://pdfium-review.googlesource.com/32743 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-22Remove return value from CJBig2_Image::SetPixel().Lei Zhang
Nobody reads it. Change-Id: I76c0f5881e5432d2086cb8eaec7fc70fa5b71536 Reviewed-on: https://pdfium-review.googlesource.com/32741 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-05-22Fix method style in JBig2_Image.Lei Zhang
Rename fooBar() to FooBar(). Change-Id: I87775fa14ce7e4f4a5897780d0d02fb61c7693ff Reviewed-on: https://pdfium-review.googlesource.com/32739 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-17Expose CJBig2_Image::ComposeTo() as a public method.Lei Zhang
CJBig2_Image::ComposeFrom() wraps a call to ComposeTo() and does an extra validity check. In tight loops where the validity check will always succeed, this is wasteful. Change existing callers of ComposeFrom() to ComposeTo() when the validity check has already been done. BUG=chromium:840728 Change-Id: I39fb42eea49b92b7804cbd42c3d8a0329edeb58d Reviewed-on: https://pdfium-review.googlesource.com/32637 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-17Consolidate identical code in CJBig2_TRDProc.Lei Zhang
Change-Id: Ib44a6b7bd19625a4081322d2471551bec894abd8 Reviewed-on: https://pdfium-review.googlesource.com/32638 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-05-16Move JBig2 HuffmanTables into JBig2_HuffmanTable.cppNicolas Pena
This CL changes the table information so it can be indexed, and allows moving all of the information to the CJBig2_HuffmanTable implementation, which is the only real user of the data. Change-Id: I88780bee32c8509198518fd3b1e82d68ae7ff707 Reviewed-on: https://pdfium-review.googlesource.com/32635 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-14Merge some values of JBig2_ResultNicolas Pena
This CL merges some of the values of JBig2_Result. The only checks are against Success and EndOfFile || EndOfPage, so we only need three values: Success, EndReached, and Failure (for anything that does not match either of those two). Change-Id: I552c54f2d70aa8e8bf52702dab4dfc00d528ef76 Reviewed-on: https://pdfium-review.googlesource.com/32393 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-05-10Remove a completeness check from CJBig2_GRRDProc::DecodeTemplate0OptNicolas Pena
https://pdfium-review.googlesource.com/c/pdfium/+/18333 introduced several checks to prevent timeouts in JBig2. One of these is breaking the PDF in the bug, so this CL removes that check. Bug: chromium:841200 Change-Id: Ia75c699b7fddc26f0353b0d64349898c4d1f744d Reviewed-on: https://pdfium-review.googlesource.com/32250 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-09Use enum class instead of int in CJBig2_Contextchromium/3426Nicolas Pena
This CL changes CJBig2_Context return methods as follows: * Internal methods return JBig2_Result instead of int. * Public methods return a bool (for success/failure) instead of int. In a followup, several of the enum class values may be merged together since they are not all needed. Change-Id: Ifdab83b8037262370cd7c4a80e94aa94d59aa589 Reviewed-on: https://pdfium-review.googlesource.com/32310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-05-09Make memory usage in CJBig2_HTRDProc::DecodeImage() O(1).Lei Zhang
Instead of allocating an N-pixel array to store some temporary values, just use a single integer. BUG=chromium:840728 Change-Id: I7a0ff83d814eff127033f25020a7c398db3c2062 Reviewed-on: https://pdfium-review.googlesource.com/32290 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-04Check CJBig2_Image is valid before filling.chromium/3423chromium/3422chromium/3421Lei Zhang
Skip a lot of work that will all fail anyway. BUG=chromium:838347 Change-Id: Iba45120e436b5547e106feb27dadea92cc948258 Reviewed-on: https://pdfium-review.googlesource.com/32053 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-02Make several Huffman decoders consistently check for integer overflows.Lei Zhang
BUG=chromium:837972 Change-Id: I6cfa28bff38870419e4b1e2bced427cfcbf843cd Reviewed-on: https://pdfium-review.googlesource.com/31912 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-01Add struct CJBig2_GRDProc::ProgressiveArithDecodeState.Lei Zhang
Track the decode state in one data structure. Also grab pointers to data structure members before tight loops when decoding. It turns out referring to this->foo in tight loops can actually slow down decoding. Change-Id: I6a09b08ca06ef05968966055b5ad20f8c89896af Reviewed-on: https://pdfium-review.googlesource.com/31790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-01Clean up CJBig2_Image compose methods.Lei Zhang
- Mark them private when possible. - Disambiguate method names. - Make method names match the style guide. - Pass in rects by reference. Change-Id: I0bf848756e81a92d20e46a81cd6260b660eaf482 Reviewed-on: https://pdfium-review.googlesource.com/31772 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Remove CJBig2_HuffmanTable::InitCodes().Lei Zhang
Use CJBig2_Context::HuffmanAssignCode() instead. Change-Id: Ief187420494a8cefa26eeedb98a55683caf7807b Reviewed-on: https://pdfium-review.googlesource.com/31538 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Change CJBig2_HuffmanTable to use struct JBig2HuffmanCode.Lei Zhang
Change-Id: I6461f81a3d8005efa75b8141c18c502a63252883 Reviewed-on: https://pdfium-review.googlesource.com/31537 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Adjust CJBig2_Context::HuffmanAssignCode().Lei Zhang
It looks a lot like CJBig2_HuffmanTable::InitCodes(). Port over the UBSAN error fix from commit 76c9a1b1. BUG=chromium:709781 Change-Id: I5d2f8fb013c09099c82b0565627b77e4fb0f8a98 Reviewed-on: https://pdfium-review.googlesource.com/31536 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Simplify CJBig2_Context::DecodeSymbolIDHuffmanTable().Lei Zhang
One of its parameters is a member variable. Change-Id: I0dcb78275d9ea5b05a77e211d178a0efb8699395 Reviewed-on: https://pdfium-review.googlesource.com/31535 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Use std::function in CJBig2_GRDProc.Lei Zhang
Pick from a set of functions before calling it, instead of having code to call all of the functions with the same parameters. Change-Id: I7f479948f50bdc1a9eb2764d5eb7505dc7434418 Reviewed-on: https://pdfium-review.googlesource.com/31533 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Disambiguate methods in CJBig2_GRDProc.Lei Zhang
Also remove method parameters that always refer to the same member variables. Change-Id: I9751d63895cc59e5280283795e39b50fd42eef94 Reviewed-on: https://pdfium-review.googlesource.com/31532 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-27Simplify CJBig2_Context::FindReferredSegmentByTypeAndIndex().Lei Zhang
It only looks for a single segment type. Change-Id: I83457c6f74c210299caec79a563e7876f4d1d9ea Reviewed-on: https://pdfium-review.googlesource.com/31534 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-27Fix style for many jbig2 methods.chromium/3412Lei Zhang
Change-Id: Ie700e132f13f2cb4851ea59b68c891e3c42af243 Reviewed-on: https://pdfium-review.googlesource.com/31531 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Add CJBig2_Image::IsValidImageSize() helper method.Lei Zhang
Change-Id: Ic2acd6f03b9b2e52b3d94d7579d5dc36c8e62c96 Reviewed-on: https://pdfium-review.googlesource.com/31530 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Sanitize another image size in CJBig2_Context::parseHalftoneRegion().Lei Zhang
BUG=chromium:836872 Change-Id: I0362fd7708043648bffa26c9248b401ea2793a21 Reviewed-on: https://pdfium-review.googlesource.com/31510 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-27Sanitize the SBNUMINSTANCES value in the JBIG2 decoder.Lei Zhang
BUG=chromium:837192 Change-Id: Ib9c0e7b4aeb6501e81308844d344a784f7c138d8 Reviewed-on: https://pdfium-review.googlesource.com/31490 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-23Add more image size checks in CJBig2_Context.Lei Zhang
BUG=chromium:834557 Change-Id: I8fb8d74f87097b39608c3f83f2fa1c4e49e69980 Reviewed-on: https://pdfium-review.googlesource.com/31170 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-06Rename core/fxcrt IFX files to IfaceDan Sinclair
This CL renames the 3 IFX files in core/fxcrt to Iface instead. Change-Id: I7cee6836650b71bc5c5729a8147fda62f0910fe3 Reviewed-on: https://pdfium-review.googlesource.com/27970 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-26Shrink some tables and kill dead code in xfa.Tom Sepez
Change-Id: Ic1260417e7d1475dd518655b2ab08f0184955d88 Reviewed-on: https://pdfium-review.googlesource.com/27170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-12Fix signedness in CJBig2_HuffmanTable, and add overflow checkNicolas Pena
Bug: 808902 Change-Id: Iad5ab63eeedc3ea85001337ba73626178c71f8b8 Reviewed-on: https://pdfium-review.googlesource.com/26470 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-01-30Revert "Revert "Use UnownedPtr instead of T* in MaybeOwned.""Tom Sepez
This reverts commit 77d8ed02c7e97471ceccee5abbabeb2fdea413c7. Reason for revert: <INSERT REASONING HERE> Original change's description: > Revert "Use UnownedPtr instead of T* in MaybeOwned." > > This reverts commit e563e8352139e4852a955e319023b09f2844aee9. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > Use UnownedPtr instead of T* in MaybeOwned. > > > > Always check the liftime in the unowned case. Doing so unearthed > > the following issues: > > > > Transient lifetime issue in jbig2_image when doing realloc(). > > Stale (but unused) dictionary pointer in CPDF_Image. > > Destruction order in error branch in cpdf_dibsource.cpp > > > > Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f > > Reviewed-on: https://pdfium-review.googlesource.com/24552 > > Commit-Queue: Tom Sepez <tsepez@chromium.org> > > Reviewed-by: dsinclair <dsinclair@chromium.org> > > TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org > > Change-Id: I3c56ee6ab502da90e3adb7507dbc8cc92f090140 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://pdfium-review.googlesource.com/24670 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org Change-Id: I0ccbbeab8be6cadc9b3a5bfefe2aca733654342f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/24671 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-01-30Revert "Use UnownedPtr instead of T* in MaybeOwned."Tom Sepez
This reverts commit e563e8352139e4852a955e319023b09f2844aee9. Reason for revert: <INSERT REASONING HERE> Original change's description: > Use UnownedPtr instead of T* in MaybeOwned. > > Always check the liftime in the unowned case. Doing so unearthed > the following issues: > > Transient lifetime issue in jbig2_image when doing realloc(). > Stale (but unused) dictionary pointer in CPDF_Image. > Destruction order in error branch in cpdf_dibsource.cpp > > Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f > Reviewed-on: https://pdfium-review.googlesource.com/24552 > Commit-Queue: Tom Sepez <tsepez@chromium.org> > Reviewed-by: dsinclair <dsinclair@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org Change-Id: I3c56ee6ab502da90e3adb7507dbc8cc92f090140 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/24670 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-01-30Use UnownedPtr instead of T* in MaybeOwned.Tom Sepez
Always check the liftime in the unowned case. Doing so unearthed the following issues: Transient lifetime issue in jbig2_image when doing realloc(). Stale (but unused) dictionary pointer in CPDF_Image. Destruction order in error branch in cpdf_dibsource.cpp Change-Id: I12b758aafeefedc7abe1e8b21a18db959929e95f Reviewed-on: https://pdfium-review.googlesource.com/24552 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-18Avoid integer overflows in CJBig2_Image::composeTo_opt2().Lei Zhang
BUG=chromium:802983 Change-Id: I866ece9c370bf05571b76b50ad23598f5038332b Reviewed-on: https://pdfium-review.googlesource.com/23151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-18Declare variables closer to use in CJBig2_Image::composeTo_opt2().Lei Zhang
Change-Id: Ifabaf71bb45ffa7e9af7da4acb21d8757e9596ce Reviewed-on: https://pdfium-review.googlesource.com/23150 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-15Revert "Check for success of decodes to avoid infinite loops"Nicolás Peña Moreno
This reverts commit dca380ffe0571be4023b11b06b8aecad9934bb06. Reason for revert: Causes missing text in a user's PDF Original change's description: > Check for success of decodes to avoid infinite loops > > Bug: 790693 > Change-Id: I9b1d87e024229d8b01f55ec554e2cc544db6ac06 > Reviewed-on: https://pdfium-review.googlesource.com/20230 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> TBR=npm@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 790693 Change-Id: I886b14e120c34da757a96f8a1f9c6a081d8326b6 Reviewed-on: https://pdfium-review.googlesource.com/22950 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-12-11Remove default arguments to CPDF_StreamAcc::LoadAllData().Lei Zhang
Add LoadAllDataFiltered() and LoadAllDataRaw() and update callers. Change-Id: I9b80ee34a358db204968acdc8b1adc9db0b6b83f Reviewed-on: https://pdfium-review.googlesource.com/20810 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Check for success of decodes to avoid infinite loopsNicolas Pena
Bug: 790693 Change-Id: I9b1d87e024229d8b01f55ec554e2cc544db6ac06 Reviewed-on: https://pdfium-review.googlesource.com/20230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-30Prevent integer overflow in CJBig2_HuffmanTable::ParseFromCodedBufferNicolas Pena
In this CL we prevent integer overflow by checking that the integers are in the appropriate range before casting from unsigned to signed. Bug: 789524 Change-Id: I41572849f18ffb0f0739c80130ee6b5061845d29 Reviewed-on: https://pdfium-review.googlesource.com/20011 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>