Age | Commit message (Collapse) | Author |
|
to fix bug 617135
617135 described an exploit against pdfium using a malformed gif.
This fix introduced a couple edge case handling lines to address
the OOB issue.
BUG= 617135
Review-Url: https://codereview.chromium.org/2230683002
|
|
If the width of the CJBig2_Image is set to 0 then the stride_pixels will be
zero and when we divide we'll get a floating point exception.
If the width or height are zero then we can exit early without proceeding with
the rest of the constructor.
BUG=chromium:635008
Review-Url: https://codereview.chromium.org/2222843004
|
|
Also make these private to ensure they aren't modified so as to
violate the bounds checks applied at creation time.
BUG=633002
Review-Url: https://codereview.chromium.org/2202013002
|
|
If the out_row_bytes is negative the alloc will fail. Verify the size before
alloc and bail if it's negative.
BUG=633381
Review-Url: https://codereview.chromium.org/2202283003
|
|
The pointer a unique_ptr contains should be checked instead of the
pointer of the unique_ptr itself.
BUG=chromium:631912
Review-Url: https://codereview.chromium.org/2205573004
|
|
Change the last use of CFX_Deletable to its actual type and remove
the use of CFX_Deletable.
Review-Url: https://codereview.chromium.org/2178613002
|
|
Use unique_ptr for class owned member variables, and remove unnecessary
or unused functions and member variable.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2149903002
|
|
Also clear up a few variable names and unnecessary brackets.
Review-Url: https://codereview.chromium.org/2143083002
|
|
FXSYS_round is painfully slow on Windows. It does range checking and
then calls an extremely expensive function. It ends up consuming half
the CPU time when decoding the images in PDFs such as this one:
https://www.ets.org/Media/Tests/GRE/pdf/gre_research_validity_data.pdf
SSE can be used to optimize this:
__m128 cmyk = {c * 255, m * 255, y * 255, k * 255};
uint32_t output[4];
_mm_storeu_si128((__m128i*)output, _mm_cvtps_epi32(cmyk));
but is cryptic, only works for x86/x64, and gives basically identical
performance to this solution - int(c * 255 + 0.5f);
The rounding behavior is not identical but in practice this rarely
matters, and in this specific case it does not matter because the edge
cases that vary are not hit.
The three divisions at the end were changed to multiplies because
profiling showed they were a significant cost.
This change reduces the image-decode stalls in the PDF listed above by
about 40%, making for a noticeably better experience. Further
optimizations are possible but would require significantly more time and
testing.
BUG=617365
Review-Url: https://codereview.chromium.org/2096723003
|
|
The ::DetectImageType method does more then just detecting the image type, it
also sets up various needed structures to handle the decoding. Instead of
skipping the ::DetectImageType call this CL changes the code to return early if
the image check fails. This should allow us to stop working on images which do
not match the required data format.
BUG=chromium:621094
Review-Url: https://codereview.chromium.org/2085493002
|
|
This cl removes code that exists but is never called. This includes:
* cfwl_formtp
* cfwl_widgetdelegate
* cfwl_scrollbar
* cfwl_theme
* cfwl_tooltip
* PWL_Label
* PWL_ListCtrl
* PWL_Signature
* PWL_IconList
* BC_ResultPoint
* BC_CommonPerspectiveTransform
* BC_CommonBitSource
* BC_PDF417Codeword
* fx_codec_flate.h (the .cpp file still exists)
Review-Url: https://codereview.chromium.org/2071953002
|
|
This change mainly contains files in fpdfsdk/ directory.
This is part of the efforts to make PDFium code compilable
by Clang chromium style plugins.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups plus removing an unused file and splitting
cxfa_eventparam out from fxfa.h
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2062313002
|
|
This change contains files in core directory which were not covered
in part I. This is part of the efforts to make PDFium code compilable
by Clang chromium style plugins.
The changes are mainly the following:
-- move inline constructor/destructor of complex class/struct out-of-line;
-- add constructor/destructor of complex class/struct if not
explicitly defined;
-- add explicit out-of-line copy constructor when needed;
-- move inline virtual functions out-of-line;
-- Properly mark virtual functions with 'override';
-- some minor cleanups;
BUG=pdfium:469
Review-Url: https://codereview.chromium.org/2060913003
|
|
The progressive decoder will attempt to verify that the provided image type
matches the actual image content. We need to disable this check when running
the fuzzer in order to target the fuzzing to specific decoders otherwise
each fuzzer will end up fuzzing all of the decoders.
BUG=chromium:587126
Review-Url: https://codereview.chromium.org/2061733002
|
|
Fix regressions from commit 4997b22.
BUG=618164
Review-Url: https://codereview.chromium.org/2053573003
|
|
Review-Url: https://codereview.chromium.org/2031653003
|
|
The code has local variables that shadow struct or class member
variables. Also, when this happens, different variable names should be
used instead of namespaces.
These were discovered by /Wshadow warning flag in Clang.
Review-Url: https://codereview.chromium.org/2034253003
|
|
Review-Url: https://codereview.chromium.org/2032613003
|
|
In CJBig2_SDDProc::decode_Arith we will set a SDNEWSYMS value to nullptr if the
height or width are 0. With the PDF from the bug, all of the decoders are set
to nullptr. Then, we call into CJBig2_TRDProc::decode_Arith and pull out
one of the nullptr decoders and attempt to use it, crashing.
This CL adds a check that we have a non-null decoder before attempting to use
the decoder.
BUG=pdfium:511
Review-Url: https://codereview.chromium.org/2048683002
|
|
CFX_PSRenderer, IFX_PSOutput, CPSOutput, CPSPrinterDriver.
Also reland commit 2d63eaa.
Review-Url: https://codereview.chromium.org/2019603002
|
|
The code may not cause error conditions, but can be improved. These
warnings include uninitialized variables, signed/unsigned mismatch,
redundant condition, and using bool in arithmetic operations.
Also remove a chunk of unused code.
BUG=chromium:613623, chromium:427616
Review-Url: https://codereview.chromium.org/2036203004
|
|
When there are duplicate variable declarations, the inner names shadow the
outter ones. This is error prone and harder to read. Remove all the
instances found by /analyze.
BUG=chromium:613623, chromium:427616
Review-Url: https://codereview.chromium.org/2027273002
|
|
When the condition is "status == FXCODEC_STATUS_DECODE_TOBECONTINUE"
while |status| never gets updated in the loop, it would enter infinite
loop.
Also, since Start_decode_MMR() never returns
FXCODEC_STATUS_DECODE_TOBECONTINUE, there is no point to check on the
return value for that.
Review-Url: https://codereview.chromium.org/2013263002
|
|
Remove an unused inheritance.
The remaining usages are a little more intricate.
Review-Url: https://codereview.chromium.org/2015743002
|
|
Replace it with two generic slots for Links and Codec usage.
Since the codec is at a lower layer than the document, we
don't provide separate get/set methods, since having a
document upon which to call these would be a layering
violation. Do the same for the Links for simplicity.
Review-Url: https://codereview.chromium.org/2005193003
|
|
Its only used to store one object, so replace it with a unique_ptr
to a class with a virtual dtor. Rename the prototypical class with
virtual dtor from CFX_DestructObject to CFX_Deletable. Rename the
fx_basic_module.cpp to cfx_modulemgr.cpp to match the one class
in it.
Review-Url: https://codereview.chromium.org/2013483003
|
|
There were two defines, BBS_ and PBS_ for the various border styles in the
system. They were the same, except PBS_ had an extra SHADOW define which was
never used.
This CL combines both of those into a single BorderStyle enum class and updates
the code as needed.
Also, removes ADDBIT, GETBIT unused defines. Updates barcode code to use
the util.h defines instead of redefinition. fsdk_baseannot names starting with _ were cleaned up and some #defines moved to constants.
Review-Url: https://codereview.chromium.org/1980973002
|
|
Add missing helper function to CFX_ByteTextBuf to avoid the
anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name
"Make" to indicate there's an allocation going on in this case.
Change some method arguments to take pre-existing ByteStrings where
possible.
Review-Url: https://codereview.chromium.org/1977093002
|
|
Searching for the anti-pattern:
void Release() { delete this; }
We must be explicit on the ownership model.
Add unique_ptrs as a result.
Review-Url: https://codereview.chromium.org/1960673003
|
|
BUG=607739
Review-Url: https://codereview.chromium.org/1934483002
|
|
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and
assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can
be overridden if the platform requies and we can pickup the Chromium version
if it has already been defined in the build.
This does change behaviour. Currently FXSYS_assert is always defined but ASSERT
is only defined in debug builds. So, the FXSYS_assert's would fire in Release
builds. That will no longer happen.
BUG=pdfium:219
Review-Url: https://codereview.chromium.org/1914303003
|
|
Use the more standard name "clear()" instead.
Review URL: https://codereview.chromium.org/1888103002
|
|
Clean up three 4701 warnings (use potientially uninitialized variable)
which are the only ones left;
Re-enable warning 4701 for GN build;
Remove an unused data structure;
BUG=pdfium:29
Review URL: https://codereview.chromium.org/1885093002
|
|
All of the ICodec_* interfaces had a single implementation. This CL removes
the interfaces and uses the concrete classes in their place.
BUG=pdfium:468
Review URL: https://codereview.chromium.org/1876023003
|
|
The few places these are called are better served by explicit
calls to CFX_ByteString() itself. This helps make Byte and
Wide strings more similar.
Also prevents fx_string.h from having any knowledge of fx_basic.h's
ByteTextBuf class.
Review URL: https://codereview.chromium.org/1870043003
|
|
Never implemented, never used.
BUG=pdfium:468
Review URL: https://codereview.chromium.org/1867573004
|
|
Review URL: https://codereview.chromium.org/1864153002
|
|
We removed the FX_DWORD typedef in favour of uint32_t. This CL cleans up the
FX_SAFE_DWORD naming to match.
BUG=pdfium:81, pdfium:470
Review URL: https://codereview.chromium.org/1861403002
|
|
This CL is a straight move of the fxge includes into core/fxge/include.
Review URL: https://codereview.chromium.org/1868533002
|
|
Review URL: https://codereview.chromium.org/1860223002
|
|
VS 2015 has a new or louder warning about 32-bit shifts that are then
assigned to a 64-bit target. This type of code triggers it:
int64_t size = 1 << shift_amount;
Because the '1' being shifted is a 32-bit int the result of the shift
will be a 32-bit result, so assigning it to a 64-bit variable is just
misleading.
In this case the code that triggers it is this:
m_IAID.resize(1 << SBSYMCODELEN);
The destination is a size_t so the warning only shows up on 64-bit
builds and doesn't indicate a real bug. But, casting the '1' constant
to size_t makes the behavior/intent more obvious and consistent and
allows enabling C4334 in Chromium.
BUG=593448
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1843253002 .
|
|
This makes pdfium code on Linux and Mac sign-compare warning free.
The warning flag will be re-enabled after checking on windows clang build.
BUG=pdfium:29
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1841643002 .
|
|
The warnings generated by Clang. This is part 1 for some simple cases.
BUG=pdfium:29
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1840483003 .
|
|
Review URL: https://codereview.chromium.org/1832173003
|
|
This CL splits apart the core/include/fpdfapi/fpdf_resource.h file and places
the classes into individual files.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1824033002 .
|
|
This CL moves the fxcrt code into the core/fxcrt directory. The only exception
was fx_bidi.h which was moved into core/fxcrt as it is not used outside of
core/.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1825953002 .
|
|
BUG=pdfium:29
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1821423002 .
|
|
It isn't buying us anthing, and it looks strange in
a struct when other uint types are already present.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1821043003 .
|
|
Remove some tables from .h file (risk of duplication).
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1814233005 .
|
|
Re-enable the following warnings:
4245: signed/unsigned conversion mismatch;
4310: cast may truncate data;
4389: operator on signed/unsigned mismatch;
4701: use potentially uninitialized local variable;
4706: assignment within conditional expression
Clean up the code to avoid those warnings.
BUG=pdfium:29
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1801383002 .
|