summaryrefslogtreecommitdiff
path: root/core/src/fxcodec
AgeCommit message (Collapse)Author
2015-12-18Merge to XFA: Cleanup CJBig2_HuffmanTable and friends.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1536923002 . (cherry picked from commit 9c061e2dfb22a0e321728b73c8650eded8828d90) Review URL: https://codereview.chromium.org/1539023002 .
2015-12-18Merge to XFA: Fix the JBIG2 decoding regressions from commit bc4b82e and ↵Lei Zhang
8a9ce57. BUG=566063 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1534323002 . (cherry picked from commit 20c8a9a66ea710b96493c9048fb65753e68b48fc) Review URL: https://codereview.chromium.org/1540673003 .
2015-12-14Merge to XFA: Get rid of most instance of 'foo == NULL'Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520063002 . (cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff) Review URL: https://codereview.chromium.org/1528763003 .
2015-12-14Merge to XFA: Get rid of most instance of 'foo != NULL'Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 .
2015-12-10Merge to XFA: Fix integer and bounds issues in sycc4{22,44}_to_rgb.Oliver Chang
Also clean up while we're here. BUG=557223 TBR=tsepez@chromium.org Original Review URL: https://codereview.chromium.org/1512833008 . (cherry picked from commit 08750d0400f1635ac33c3234cb11b192f31a1eeb) Review URL: https://codereview.chromium.org/1521473003 .
2015-11-25Manual fixups to PDF_ENABLE_XFA in core/Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1477663003 .
2015-11-25Inflict PPDF_ENABLE_XFA ifdefs on XFA core/Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1471323004 .
2015-11-25Merge to XFA: Fix two memory leaks from pdfium_unittestsQin Zhao
- remove redundant alloc in fx_codec_jpx_unittest.cpp - free memory allocated by HexDecode calls in fpdf_parser_decode_unittest.cpp BUG=PDFium:239 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1467183006 . (cherry picked from commit 6c2d736011c09266015d3e2a0b9c08aeba1bbf31) Review URL: https://codereview.chromium.org/1477833002 .
2015-11-24Merge to XFA: Fix a NULL pointer crash in the CJBig2_Image copy constructor.Lei Zhang
Also change the copy ctor to take a const ref. BUG=560520 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1472113002 . (cherry picked from commit d03bc01003ae2603dafdc07b901ffef0a509a2b9) Review URL: https://codereview.chromium.org/1478473002 .
2015-11-20Merge to XFA: Change |CCodec_ScanlineDecoder::m_Pitch| to FX_DWORDOliver Chang
This matches the type of the corresponding |CFX_DIBSource::m_Pitch|, where integer overflow is checked for FX_DWORD. This change is propagated to many other places. Also, check for integer overflow in |CCodec_RLScanlineDecoder::Create| during the calculation of |m_Pitch| since it aligns to 4 bytes while overflow was was previously checked without this alignment. TBR=tsepez@chromium.org BUG=555784 Review URL: https://codereview.chromium.org/1460033002 . (cherry picked from commit e7950df70a2fd658f466751b29483436cb31e829) Review URL: https://codereview.chromium.org/1461363002 .
2015-11-20Reduce diffs with master in coreTom Sepez
This week's version. Mostly whitespace, but takes the master version of core/src/fxge/ge/fx_ge_text.cpp verbatim. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1462923004 .
2015-11-19Merge to XFA: Add more overrides.Lei Zhang
Using Chromium's clang + build options, there's more override warnings. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1453643002 . (cherry picked from commit 126ba519bdd489ec6c285d1410dcae773e8ef673) Review URL: https://codereview.chromium.org/1458373002 .
2015-11-19Merge to XFA: Add a missing setjmp() to CCodec_JpegDecoder::v_GetNextLine().Oliver Chang
If jpeg_read_scanlines() ends up calling the error callback, we longjmp into some undefined state. BUG=558840 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1463563003 . (cherry picked from commit 06e33aec03f13c76d9eff5c09cb03e142b0c5ef1) Review URL: https://codereview.chromium.org/1462253004 .
2015-11-16Merge to XFA: Reland "Cleanup some numeric code.""Dan Sinclair
This reverts commit 0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1449873003 . (cherry picked from commit 3f148915d12f54a946a0c0bf526162b79c39d650) Review URL: https://codereview.chromium.org/1452673002 .
2015-11-12Merge to XFA: Remove relative includes.Lei Zhang
That refer to parent directories. TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 . (cherry picked from commit 22bc4227fbbda5a5e9abad2a2c0a98c04fe7f228) Review URL: https://codereview.chromium.org/1439223003 .
2015-11-10Merge to XFA: Fix relative includes within core/Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1427633010 . (cherry picked from commit 9fb27cb9797937499c9678bc74cf7846cbf5d2b8) Review URL: https://codereview.chromium.org/1438573002 .
2015-11-09Merge to XFA: Fix all relative includes to core.Lei Zhang
Do some IWYU to fix build errors due to files that have no #includes but just happened to work previously because the #includes were in the right order. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1407423004 . (cherry picked from commit 9e7cd8ffb81c564e1102f6c6459ec0942a0b11ea) Review URL: https://codereview.chromium.org/1425163004 .
2015-11-09Merge to XFA: Remove dead code in fx_codec_jbig_enc.cpp.Lei Zhang
TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1420693004 . (cherry picked from commit 37e4a11e58257b757bec2700bc53facc59d0b845) Review URL: https://codereview.chromium.org/1423583005 .
2015-11-06XFA: Actually fix all relative includes to third_party.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1413253003 .
2015-11-06Merge to XFA: Fix all relative includes to third_party.Lei Zhang
- In non-standalone builds, use the provided jpeg library. - Run gn format over all the GN files. - Also roll DEPS for buildtools to c2f2598. - And fix XFA's lack of #includes. BUG=541704 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425153006 . (cherry picked from commit 34bb6c58fe60206a08dc0a1f37b7cfe83e8c762c) Review URL: https://codereview.chromium.org/1434543003 .
2015-10-30Merge to XFA: Remove external jpeg provider interface.Tom Sepez
(cherry picked from commit 3d59bd9d66d01eb39c30742bce67fa0376cb4ea8) Review URL: https://codereview.chromium.org/1407903005 . Conflicts: core/include/fxcodec/fx_codec_provider.h core/src/fxcodec/codec/codec_int.h core/src/fxcodec/codec/fx_codec_jpeg.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1412713009 .
2015-10-30XFA: Remove null CFX_DIBAttribute default argument.Tom Sepez
Add some consts and overrides along the way. Group some statics together. Tidy some unused vars. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1411683005 .
2015-10-30XFA: bring fx_codec_fax in-line with masterTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1419473006 .
2015-10-29XFA: remove unsafe exif parsing codeTom Sepez
Fortunately, this could only be called with a null buffer, so none of unchecked lengths could be used. The remaining use of the CFX_/IFX_DIBAttributeEx class is as a table, so put one directly in the CFX_DIBAttribute. Fix a "register" warning along the way. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1425983002 .
2015-10-29XFA: Remove unused _JpegLoadIccProfile()Tom Sepez
In turn, remove now unused _JpegIsIccMarker(). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1418653008 .
2015-10-23XFA: make JBig2_HuffmanTable.cpp match masterTom Sepez
Includes one array bounds fix. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1412583003 .
2015-10-22XFA: Make fx_codec_jpx_unittest.cpp match masterTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1412453005 .
2015-10-20XFA: Remove cond ? TRUE : FALSE.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1409323003 .
2015-10-19Merge to XFA: Sanity check the values of TRUE and FALSE.Lei Zhang
Get rid of cond ? TRUE : FALSE. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405723003 . (cherry picked from commit aff4635dad81bc319266d9d84b81552580cd2b65) Review URL: https://codereview.chromium.org/1412793003 .
2015-10-16Merge to XFA: Fix a bunch of sign mismatch warnings.Lei Zhang
Also remove some gotos and move code into an anonymous namespace. And then do the partial revert to avoid size_t going negative. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1356373003 . Review URL: https://codereview.chromium.org/1400723002 . (cherry picked from commit d03ba8d1a5928e8f3f6bd7da063b53b0bc40abfd) (cherry picked from commit a398ca611d1925182ff6a4e8b2b43c277c364dc0) Review URL: https://codereview.chromium.org/1406373002 .
2015-10-12XFA: Move fx_codec's lpng and tiff to third_party/Tom Sepez
We did this with the other codecs in master, but these two are XFA-only, and did not get the same treatment. Remove some fx_ prefixes in the third-party file names. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1392373004 .
2015-10-09Merge to XFA: Sanitize CJBig2_SymbolDict's memory usage.Lei Zhang
- Use std::vector<JBig2ArithCtx> instead of storing pointers to arrays. - Make CJBig2_SymbolDict's members private with accessors. - Use std::vector<JBig2ArithCtx> in related places. - Steal Chromium's vector_as_array() and use it as an adaptor as needed. BUG=514891 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1388203003 . (cherry picked from commit 3acb1ef909a22368507ed13817c4988c818e3aee) Review URL: https://codereview.chromium.org/1401533004 .
2015-10-09Merge to XFA: Fix include paths for fx_system.hLei Zhang
TBR=dml@google.com Review URL: https://codereview.chromium.org/1390863002 . (cherry picked from commit fb0334733cf4a541636128f77f9fe8067a8c70f6) Review URL: https://codereview.chromium.org/1395213003 .
2015-10-09Merge to XFA: Fix a compiling error on MacJun Fang
BUG=497357 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1395493003 .
2015-10-09Merge to XFA: Fix heap-buffer-overflow in color_sycc_to_rgbJun Fang
It's a bug existing in the conversion from YUV420 to RGB. For YUV 420 format, four pixels have 4 Y but only one U and one V. In some cases, there are odd columns or lines in some images. The pixels on last line or column may have Y but no U or V data. For this case, We shall extend U or V using the data on previous column or line. BUG=497357 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1342683002 .
2015-10-08Merge to XFA: Fix a malloc/delete mismatch introduced in commit 8a9ce57.Lei Zhang
Just get rid of the malloc altogether and use CJBig2_List instead. BUG=540873 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1394933002 . (cherry picked from commit 06f255ca4040f3d73cf09f1dbd63a3b167f6a4c1) Review URL: https://codereview.chromium.org/1400663003 .
2015-10-08Merge to XFA: Various changes to JBig2 cache:Lei Zhang
- Makes the cache be per-document - Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits). - Makes it so the cache is only used for the globals stream. - Reenable the cache. R=dml@google.com TBR=dml@google.com BUG=pdfium:207 Review URL: https://codereview.chromium.org/1380243004 . (cherry picked from commit f1b88e76134808f36f16b9e53a2e9dd89b12c8fd) Review URL: https://codereview.chromium.org/1394373002 .
2015-10-08Merge to XFA: Put CJBig2_SymbolDict's images in a CJBig2_List container.Lei Zhang
Also mark it private. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1395613003 . (cherry picked from commit 8793b4a071fad51a770b93838e0752505b020e43) Review URL: https://codereview.chromium.org/1397853002 .
2015-10-07Merge to XFA: Stop inlining CJBig2_BitStream.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1393823002 . (cherry picked from commit a0f2b67bd659e3f1780edfac56d8754bca685d5f) Review URL: https://codereview.chromium.org/1390883004 .
2015-10-07Merge to XFA: Fix the Windows build after commit 8a9ce57.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1396533002 . (cherry picked from commit 80aa8c26887d98f654a9eecf7298663656cfc40f) Review URL: https://codereview.chromium.org/1396743002 .
2015-10-07Merge to XFA: Remove gotos in JBig2 code.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1382613003 . (cherry picked from commit 8a9ce5778e0789beb7ba15a62c592a353a51bcdd) Review URL: https://codereview.chromium.org/1397683002 .
2015-10-07Merge to XFA: Fix regression in JBIG2 decoding from commit ce37d73.Lei Zhang
many callers can tolerate CJBig2_ArithIntDecoder::decode() OOB failure. BUG=539749, pdfium:209 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1384663007 . (cherry picked from commit 35902e725aa6cc83a317c3b6fdd1926b81b8e44b) Review URL: https://codereview.chromium.org/1396663003 .
2015-10-07Merge to XFA: Remove some dead code from CCodec_Jbig2Module. Variable was ↵Lei Zhang
only ever set to false. TBR=dml@google.com Review URL: https://codereview.chromium.org/1393153002 . (cherry picked from commit 1f439a7a3b7c44235ecdac9a411add8fb62b0d83) Review URL: https://codereview.chromium.org/1392873003 .
2015-10-05Merge to XFA: Disable JBIG2 cache; prevent data corruption - try 2.Lei Zhang
Also change CJBig2_SymbolDict::DeepCopy() to return a unique_ptr to prevent a potential leak if the cache size was 0. BUG=pdfium:207 R=tsepez@chromium.org, jbreiden@google.com Review URL: https://codereview.chromium.org/1374633004 . (cherry picked from commit fd12ec5584d9a17f310a2c0c408a438ef3b1ce63) Review URL: https://codereview.chromium.org/1390673002 .
2015-10-02Merge to XFA: Get rid of gotos in CPDF_SyntaxParser and FlateUncompress().Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1360103002 . (cherry picked from commit b8a074711108baf04017d86207e08c19ff327d8e) Review URL: https://codereview.chromium.org/1384123002 .
2015-10-02Merge to XFA: Prevent divide by zeros in CJBig2_GSIDProc::decode_MMR().Lei Zhang
Check the image size before attempting to decode. BUG=538103 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1377493005 . (cherry picked from commit 9fb70fbded5c0bf4f5313a49fd3496b4d4fa71ca) Review URL: https://codereview.chromium.org/1379233003 .
2015-10-02Merge to XFA: Fix PNG decoding divide by zero error due to zero row count.Lei Zhang
BUG=537790 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1379243002 . (cherry picked from commit 095a83c59120c108d9ac6f0ab71fd3faa5eea810) Review URL: https://codereview.chromium.org/1380563003 .
2015-10-01Merge to XFA: Disable JBIG2 cache; prevent data corruptionLei Zhang
BUG=pdfium:207 Original author: jbreiden@google.com Original CL: http://codereview.chromium.org/1362133003/ TBR=jbreiden@google.com Review URL: https://codereview.chromium.org/1382073002 . (cherry picked from commit 7886d8dcf3bc9ef9b51e733d77bd3243ef32adb8) Review URL: https://codereview.chromium.org/1379603004 .
2015-10-01Merge to XFA: Clean up some image decoder classes:Lei Zhang
- Use std::vector<uint8_t> instead of raw uint8_t* - Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t* - Add FxFreeDeleter, use it in CCodec_ImageDataCache. - Make CCodec_ImageDataCache encapsulate its data members. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1361053002 . (cherry picked from commit 022da0014faa103901ec107ed6a33e5ab00c7931) Review URL: https://codereview.chromium.org/1372993003 .
2015-10-01Merge to XFA: Cleanup JBig2_ArithIntDecoder.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1359013003 . (cherry picked from commit ce37d7347f1ab4c9fc1f48a137628da641bb4f14) Review URL: https://codereview.chromium.org/1386473002 .