summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-10-03Move initialization of CPDF_CryptoHandler into CPDF_SytnaxParser initialization.Artem Strygin
Change-Id: I70d04f38767f2c17c41407fc9b4fc25519ba32f4 Reviewed-on: https://pdfium-review.googlesource.com/15330 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Use ByteString instead raw string for password in CPDF_SecurityHandler.Artem Strygin
Change-Id: I598d42027d033b250134429dfdf92ba043a523a3 Reviewed-on: https://pdfium-review.googlesource.com/15310 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Move the CryptoHandler into the SecurityHandlerArtem Strygin
Change-Id: Idb5928e65833641d0443d955e4f2866d0f94cf5f Reviewed-on: https://pdfium-review.googlesource.com/15291 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Remove the parser from the CPDF_SecurityHandler .Artem Strygin
Change-Id: I9fb651285c158e0f61d19e1aaf0d8bcfd302a22f Reviewed-on: https://pdfium-review.googlesource.com/15290 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Change the ownership of the CPDF_CryptoHandler.Artem Strygin
Change-Id: I3ae8337c1a77063470eb5baa97db62ea2e90688b Reviewed-on: https://pdfium-review.googlesource.com/15230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Reduce calls of external API within CPDF_ReadVaildatorArtem Strygin
Change-Id: Ib5aac82213138c1b3f99a458894329265d1e1b05 Reviewed-on: https://pdfium-review.googlesource.com/13731 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Improve CPDF_ReadVaildatorArtem Strygin
Merge CPDF_ReadValidator::IsXXXAvailable and CPDF_ReadValidator::SheduleXXXDowload methods into one CheckXXXAndRequestIfUnavailable. Change-Id: Ib108d5bc3589df17269c841b0024dd4690909304 Reviewed-on: https://pdfium-review.googlesource.com/13730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Rewrite how GIF headers are readRyan Harrison
Break up reading the signature and local screen descriptors into seperate functions. Fix a bug in how matching in the signature validation works. Move LSD value assignment to after sufficient data has been confirmed. Convert LSB to MSB methods where they were just wrong. Add unit tests for ReadData, SetInputBuffer, ReadSignature, ReadLocalScreenDescriptor, and ReadHeader. BUG=pdfium:913,chromium:770470 Change-Id: I1683b8aefc11300625b9be8087c6988549308a8f Reviewed-on: https://pdfium-review.googlesource.com/15250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Replace GetWord_LSBFirst with FXWORD_GET_LSBFIRSTchromium/3231Ryan Harrison
The existing implementation of a LSB first word method was incorrect, in addition it was implemented to the BMP code, but also used in the GIF code. Thus is should be moved to a common location. Also added in an implementation for FXWORD_GET_MSBFIRST, since the GIF code will need this. BUG=pdfium:914 Change-Id: I0e84813356fbd456b293a190da3c2cde01a6580b Reviewed-on: https://pdfium-review.googlesource.com/15210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-02More define cleanupDan Sinclair
Remove unused defines; Move to .cpp files where possible; Fixup values. Change-Id: I88cd5deb04b14ab8e9f8097a695c3d0b52d64b4c Reviewed-on: https://pdfium-review.googlesource.com/15130 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-02Remove extraneous ;sDan Sinclair
Bug: pdfium:912 Change-Id: Iea61260ccc972627950b470a44ab21dbd2b4045b Reviewed-on: https://pdfium-review.googlesource.com/15170 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-02Remove useless code.Artem Strygin
Change-Id: I521d6e83f392820c40f6be930ff3bf160b766b52 Reviewed-on: https://pdfium-review.googlesource.com/15150 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Move CPDF_Parser::ObjectType into protected sectionArtem Strygin
Change-Id: I2a26647359a7d14d7d1269fe2835e0b3184f2ca8 Reviewed-on: https://pdfium-review.googlesource.com/13732 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Implement CPDF_CryptoHandler::DecryptObjectArtem Strygin
Decryption logic has been extracted from CPDF_SyntaxParser::GetObjectBody into CPDF_CryptoHandler::DecryptObject Performance comparison results: https://pdfium-review.googlesource.com/c/pdfium/+/12970 Change-Id: Iaeaed56b7f96166bbbcf6db162192d2ba9af4698 Reviewed-on: https://pdfium-review.googlesource.com/12971 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Use std::make_tupleDan Sinclair
This CL updates cfx_fontmapper to use std::make_tuple instead of the {} variant. Change-Id: I1eeeeed803fd4b813f3dbf7b3d23416af9400b6f Reviewed-on: https://pdfium-review.googlesource.com/15131 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-02Removing unused definesDan Sinclair
Remove unused defines. Change-Id: Ibf10d8470f19cbf4528fe1342398a39ef15c1d12 Reviewed-on: https://pdfium-review.googlesource.com/15110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-29Extract test subclasses of IFX_SeekableReadStreamRyan Harrison
There are multiple instances of subclasses that either act as an invalid stream or one backed by a memory buffer. Merging all of these into two shared stream classes and removing the others. BUG=pdfium:911 Change-Id: I264602808c6dc0e5c878da462a5e00883fe43e51 Reviewed-on: https://pdfium-review.googlesource.com/15093 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
Use methods to match font information; cleanup some font code. Change-Id: Ib99c1e466e56723cb5d264d49e1caf9bbbc0daed Reviewed-on: https://pdfium-review.googlesource.com/15072 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
This CL removes duplicate defines between XFA and core. Several OR'd values have been coverted into individual booleans to make the code clearer. Change-Id: Ic32a71c711cffd9a0cf1136e5a22f0502e085c39 Reviewed-on: https://pdfium-review.googlesource.com/15071 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Convert LZW decompressor to use vector instead of static arraychromium/3230chromium/3229chromium/3228chromium/3227Ryan Harrison
Speciifically replacing what was called the "stack_", an array, with a vector called "decompressed_". The fact that this data structure wasn't actually a stack caused a lot of grief when refactoring. BUG=pdfium:903 Change-Id: I056f8fc9183bcde67a03dc9de0dae9ddf9fb0f37 Reviewed-on: https://pdfium-review.googlesource.com/15092 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-28Implement FakeFileAccess.Artem Strygin
Update embedder tests to simulate unavailable data and download requests. Change-Id: I634fa89d2a0c859243e849752936da87568909f4 Reviewed-on: https://pdfium-review.googlesource.com/11890 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Simplify some OS checks to PLATFORM checksDan Sinclair
This CL simplifies the OS == WIN{32|64} checks to be PLATFORM == WINDOWS checks. Change-Id: I1493d316dd457b0228e4ef39db4cf1d2b8abf97d Reviewed-on: https://pdfium-review.googlesource.com/14870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Fix load non first pages in linearized document with hints table.Artem Strygin
Tha problem was, that when we use hints tables, we do not check pages tree availability, but currently for receiving page object in CPDF_Document, the pages tree should be available anyway. Change-Id: I908d00027fd8727f074a38e47fea095229ef5147 Reviewed-on: https://pdfium-review.googlesource.com/11892 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Fix infinite loop on form availability check.Artem Strygin
The problem was, that the CPDF_SyntaxParser read last block not from requested position. In this case It move down requested position to fill whole buffer. As result this additional data was not requested by DownloadHints. To fix this allow resize data buffer in CPDF_SyntaxParser, to store more small block, and always read from requsted position. Also add reading check into CPDF_Parser::LoadLinearizedMainXRefTable to prevent infinite loops. Change-Id: I14d3f4457393025dca390aa3ceaa940716463534 Reviewed-on: https://pdfium-review.googlesource.com/11891 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Remove no-op castRyan Harrison
Change-Id: I2427e29291218a7b004591673bd5281f23f1284a Reviewed-on: https://pdfium-review.googlesource.com/15091 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Cleanup some font headersDan Sinclair
This CL moves some font defines to the only .cpp file they're used in and removes un-needed forward declarations from fx_font.h. Change-Id: Ic291a42d6bddfa6537111a7d42728802236e6e26 Reviewed-on: https://pdfium-review.googlesource.com/14970 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-27Hide FaceFontInfo inside CFX_FolderFontInfoDan Sinclair
This CL moves CFX_FaceFontInfo to be a protected inner class of CFX_FolderFontInfo. Change-Id: I3674c36d5295307be253e04337c22d6d0608fefe Reviewed-on: https://pdfium-review.googlesource.com/14952 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-27Remove error strings from BMP decoding pathRyan Harrison
These are error strings are set but never used for anything. BUG=pdfium:907 Change-Id: I08d9547009116f7386d15b4a965b9a99c7bf1997 Reviewed-on: https://pdfium-review.googlesource.com/15010 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Cleaning up naming of GIF files/classes/variablesRyan Harrison
Moved everything from core/fxcodec/lgif to core/fxcodec/gif Converted CGifContext -> CFX_GifContext Removed _ptr suffixes from CXF_GifContext Movef fx_gif.* -> cfx_gif.* Renamed structs in cfx_gif.h Renamed members of CFX_GifImage Renamed members of CFX_GifContext Renamed CFX_LZWDecoder -> CFX_LZWDecompressor BUG=pdfium:903 Change-Id: I537e905e935da26832e6bbdc03e0373ed5500bcb Reviewed-on: https://pdfium-review.googlesource.com/14990 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-27Move CFX_Font definition to cfx_font.hDan Sinclair
This CL moves the CFX_Font definition out of fx_font.h and into cfx_font.h to match the cfx_font.cpp implementation. Change-Id: Icc2fc7463fa4b9d0bec925e80b60a638136a83a1 Reviewed-on: https://pdfium-review.googlesource.com/14951 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-27Remove error string from CGifContextRyan Harrison
This string is set, but never used. BUG=pdfium:907 Change-Id: I57555d0dd3670b245554ff2d7163d1d04bcdb7e8 Reviewed-on: https://pdfium-review.googlesource.com/14930 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Cleanup fx_freetype.hDan Sinclair
This CL converts typedefs to using statements, removes unused defines and changes c-style casts to static_cast or reinterpret_cast as needed. Change-Id: Id700eed82a7e59574b0769567084ee442e56b151 Reviewed-on: https://pdfium-review.googlesource.com/14950 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-27Remove FXSYS_strlen and FXSYS_wcslenchromium/3226Ryan Harrison
With the conversion of internal string sizes to size_t, these wrappers are no longer needed. Replacing them with strlen and wcslen respectively. BUG=pdfium:828 Change-Id: Ia087ca2ddaf688a57ec9bd9ddfb8533cbe41510d Reviewed-on: https://pdfium-review.googlesource.com/14890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-27Replace FX_SAFE_STRSIZE with FX_SAFE_SIZE_TRyan Harrison
BUG=pdfium:828 Change-Id: If9560338c456b28f968e743a90a3629791d87df0 Reviewed-on: https://pdfium-review.googlesource.com/14832 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-27Remove FX_STRSIZE and replace with size_tRyan Harrison
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Make names of GIF types less opaqueRyan Harrison
A lot of the structs in the GIF code use acronyms that are non-obvious unless you are familar with the GIF spec, and even then lead to lots of looking back. Making the naming more explicit. Also converted GifImage to be a struct, since it didn't have any methods defined for it. BUG=pdfium:903 Change-Id: I97ca2adfdc4ada8bcaef5f8f317c1dea7365d70d Reviewed-on: https://pdfium-review.googlesource.com/14836 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Add in missing ! to conditionalRyan Harrison
This was causing us to use the local palette values when they didn't exist, instead of the global palette values. BUG=chromium:769292 Change-Id: I02d19cbcf0cf9e362e123fc7648d8f47991b8155 Reviewed-on: https://pdfium-review.googlesource.com/14910 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Remove unreachable code in fx_codec_iccNicolás Peña
This CL removes unreachable code and also removes the flag Icc_Format_DEFAULT which becomes unused. Bug: chromium:346399 Change-Id: I1cdd0f70ffec2abcd20ddf5b181273971b92ecaa Reviewed-on: https://pdfium-review.googlesource.com/14850 Commit-Queue: Nico Weber <thakis@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org>
2017-09-27Cleanup FX macrosDan Sinclair
This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-26Remove _FX_IOS_chromium/3225Dan Sinclair
The _FX_IOS_ define is never defined, so it isn't useful to check _FX_OS_ against. Remove. Change-Id: I90b50a1a0dc165073ed223cbfe861b9a227818dd Reviewed-on: https://pdfium-review.googlesource.com/14831 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-26Fix checks for FX_WIN64_DESKTOPDan Sinclair
Several of the OS checks were mis-typed as FX_WIN64 instead of FX_WIN64_DESKTOP. This CL updates the defines to check for the correct OS define. Bug: pdfium:906 Change-Id: Ib58a6472d1bc26c34d509edf32ac00b18d852a3b Reviewed-on: https://pdfium-review.googlesource.com/14813 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-26Confirm that a global palette has data before attempting to use itRyan Harrison
Previous implementation assumed that if the local colour palette was not specified and the global palette had its size specified, then use the global. If the global palette is disable, it will not have data, but it may have a size. Technically the size is giberish in this case, but the value is allowed to be non-zero, so isn't a sufficient check. BUG=chromium:768089 Change-Id: Iaec15fcd65f3983056df7d56d29118a516334cd9 Reviewed-on: https://pdfium-review.googlesource.com/14819 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-26Move LZW decoder out of fx_gifRyan Harrison
CGifLZWDecoder has been moved out into its own file, name changed to CFX_LZWDecoder, member variable names updated, creation pattern changed, and unit tests added. Wrt the creation pattern, there is no longer a constructor and 2 initialization methods that need to be called. Instead all of the initialization is done as part of the constructor. A wrapper has been added for generating a std::unique_ptr<CFX_LZWDecoder>, so that params can be validated. BUG=pdfium:900,pdfium:901,pdfium:903,pdfium:904 Change-Id: Idcbe773f7fb18b08e64d5a89bfd87d4801332c53 Reviewed-on: https://pdfium-review.googlesource.com/14814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-26Remove fx_text_int.hDan Sinclair
The CFX_SizeGlyphCache is only used internally by the CFX_FaceCache. This CL moves the definition to that file and removes fx_text_int.h Change-Id: I38f26f437f0eaa72492995ae7442d5c38ed2f229 Reviewed-on: https://pdfium-review.googlesource.com/14771 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-25Hide CFX_UniqueKeyGenDan Sinclair
The CFX_UniqueKeyGen struct is only used in cfx_facecache.cpp. This CL moves the struct to the anonymous namespace of that file. Change-Id: I1ec85126070e2e0446abc5639cea8465cb490f1a Reviewed-on: https://pdfium-review.googlesource.com/14770 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-22Move C-style functions into CGifContextRyan Harrison
There are a number of functions in fx_gix.h/.cpp that take in a pointer to a CGifContext as their first parameter. Moving these to be methods in that class. BUG=pdfium:902 Change-Id: I8c583ab9e42dda4241aa8a6f865408a94fa6d273 Reviewed-on: https://pdfium-review.googlesource.com/14670 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-22Fix crash when rendering invalid GIFRyan Harrison
The core fix in this CL is a change to how LWZ decompression works, so that when the min code table size and the color palette size are different, color codes after the end of the defined color palette are considered errors. This CL also introduces a bunch of tweaks to the call return path, since there were multiple locations where the GIF decode failing status was being dropped on the floor, so the end widget would have a bitmap with the default colour in it, instead of nothing. BUG=chromium:616671 Change-Id: Id6f40d552dc24650c91e9903f710ff2fa63bc774 Reviewed-on: https://pdfium-review.googlesource.com/14630 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-21Rename CPDF_SyntaxParser::GetObject to GetObjectBodyArtem Strygin
Change-Id: Ia8fd1893f862391fbada396f505ac16985b59cd6 Reviewed-on: https://pdfium-review.googlesource.com/12850 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_WeakPtr to WeakPtrDan Sinclair
This CL renames CFX_WeakPtr to WeakPtr and moves into the fxcrt namespace. Bug: pdfium:898 Change-Id: Ide50a8afeb1e987c48c8fbd103898745c9199d6a Reviewed-on: https://pdfium-review.googlesource.com/14621 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Move CFX_UnownedPtr to UnownedPtrDan Sinclair
This CL moves CFX_UnownedPtr to UnownedPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I6d1fa463f365e5cb3aafa8c8a7a5f7eff62ed8e0 Reviewed-on: https://pdfium-review.googlesource.com/14620 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>