summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-10-23Fix some integer overflows in CJBig2_TRDProcNicolas Pena
Bug: 649278 Change-Id: Ib9084f6d9bb7dc7bf3713faa22d3a26822a96681 Reviewed-on: https://pdfium-review.googlesource.com/16550 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-10-23Return error when attempting to load frame with 0 heightRyan Harrison
A frame with 0 height will have no data, so there is not point in attempting to load it. Additionally some of the loading code assumes a non-zero height implicitly. BUG=chromium:770470 Change-Id: I38b222b46b43ce5d47924526913285510be40603 Reviewed-on: https://pdfium-review.googlesource.com/16551 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-23Fix cpdf_textpage so it doesn't omit spaces.Andrew Weintraub
Bug: pdfium:921 Change-Id: I8864fd2ebdccc5f94aaf70cd8295068bf4db8b68 Reviewed-on: https://pdfium-review.googlesource.com/16492 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-23Cleanup some javascript color codeDan Sinclair
This CL changes the color conversion methods to return their result instead of taking an out param. Change-Id: I19ca2b395145866533c7f93cbad80cdf4d7df05d Reviewed-on: https://pdfium-review.googlesource.com/16530 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-23Validate pattern sizes before usageDan Sinclair
This CL adds some validation into the tiling pattern drawing code. BUG: chromium:775365 Change-Id: I7bcad7f7f2c83982cd955f92091658b46f6b820b Reviewed-on: https://pdfium-review.googlesource.com/16190 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-10-21Fix a FPDF_GetMetaText() crash.Lei Zhang
With a newly created document, there is no parser. CPDF_Document is missing a nullptr check which can be triggered via FPDF_GetMetaText(). BUG=pdfium:915 Change-Id: If9a300a6dc2ca5914c3544eae5c27fe3139dd821 Reviewed-on: https://pdfium-review.googlesource.com/16490 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-10-20PostScript: Do not send fonts with size <= 0 to printerschromium/3246rbpotter
Bug: chromium:767343 Change-Id: I9321e7565feb423a1283c74e91297eeaeb80083f Reviewed-on: https://pdfium-review.googlesource.com/16410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
2017-10-19Tidy up bits of CPDF_RenderStatus.Lei Zhang
Also check the return value for a Clone() call. Change-Id: Ia2775c2f70aafa2874f5d4172e0dc178854a3f51 Reviewed-on: https://pdfium-review.googlesource.com/15791 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-10-19Fix integer overflows in cfx_font.cpp.chromium/3245Henrique Nakashima
Bug: chromium:775587 Change-Id: If927ebc0080a53d1c67f0aee5cab525fbcc24260 Reviewed-on: https://pdfium-review.googlesource.com/16290 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-18Fix rounding of colour valuesDan Sinclair
This CL fixes rounding issues with the colour values when written then read from path objects. Bug: pdfium:919 Change-Id: I8ab33706f1c7d81c3ec755706b1a613cf2a557b3 Reviewed-on: https://pdfium-review.googlesource.com/16270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-17Fix loading mutually referencing colorspaces.chromium/3243Henrique Nakashima
CPDF_DeviceNCS and CPDF_SeparationCS can load other colorspaces and their v_Load() needs to pass around a set of visited spaces to avoid stack overflows if that other colorspace references the first one. Bug: chromium:773095 Change-Id: Idae26c95a8034c3ded70f70e20ae1c414d7b29c3 Reviewed-on: https://pdfium-review.googlesource.com/16250 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-17Remove fxge/ friend classesDan Sinclair
This CL removes friends from classes in fxge/. Change-Id: I8180004de3ebf818ed4c8d5256a01c33cd2d880e Reviewed-on: https://pdfium-review.googlesource.com/16170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-16Simplify CPVT_GenerateAP interfaceDan Sinclair
This CL moves the annotation decision inside GenerateAnnotAP and hides the individual annotation AP generation methods. The form methods are hidden inside GenerateFormAP and a general GenerateEmptyAP has been added. Change-Id: I9e761cb10ceca70681df4e546631a7859f1bfc7c Reviewed-on: https://pdfium-review.googlesource.com/16130 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-16More more CPVT_GenerateAP methods to anonymous namespacechromium/3242Dan Sinclair
The Edit, Border and Color generation methods are only used in the CPVT_GenerateAP file. This CL moves them to the anonymous namespace. Change-Id: I2a5805edddd1ffb5616608054111e08e0b3f8e6f Reviewed-on: https://pdfium-review.googlesource.com/16110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-16Cleanup CPVT_GenerateAPDan Sinclair
This CL moves FPDF_GenerateAP into the anonymous namespace of CPDF_AnnotList. Several methods are moved into the anonymous namespace of CPVT_GenerateAP which are only used internally. Change-Id: I6e8fef54ba3757cc9873ed5ac370dec7eaca5d8b Reviewed-on: https://pdfium-review.googlesource.com/16070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-16Hide CPVT_Dash in CPVT_GenerateAPDan Sinclair
The CPVT_Dash struct is only used in CPVT_GenerateAP. This CL moves the struct definition into the cpp class and removes the cpvt_dash.h file. Change-Id: I0f0c9279ded1086d47e81f1057d51121d9466974 Reviewed-on: https://pdfium-review.googlesource.com/16050 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-16Convert CPVT_Color to CFX_ColorDan Sinclair
This CL converts the use of CPVT_Color to CFX_Color and removes the CPVT_Color class. Change-Id: I86a2d06524cd8f0fbce2335f0185426cc41dbe84 Reviewed-on: https://pdfium-review.googlesource.com/16030 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-12Add more checks to fseeks in CFX_FolderFontInfoNicolas Pena
Bug: chromium:770890 Change-Id: Iee532d76aabc0763a835c203344455ba07c6e82c Reviewed-on: https://pdfium-review.googlesource.com/15930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-10-10Fix dangling pointer to ID array in CPDF_SecurityHandler.chromium/3238chromium/3237Henrique Nakashima
This was caused by breaking the reference from CPDF_SecurityHandler to CPDF_Parser in https://pdfium-review.googlesource.com/c/pdfium/+/15290 The reference was replaced with a reference to the ID Array and a copy of the password. The issue is that when parsing PDFs with multiple trailers, the trailer containing the ID array may be replaced and destroyed in CPDF_Parser::TrailerData::SetMainTrailer() after being passed to CPDF_SecurityHandler, which would then have a dangling pointer to it. This CL changes the CPDF_SecurityHandler to hold a copy of the original file ID instead of all the ID Array. Bug: chromium:771479,chromium:772376 Change-Id: Id98100502093d890fc2fe6a3da139f910daf38f4 Reviewed-on: https://pdfium-review.googlesource.com/15910 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-10-10Fix crash when offset > file_size_ in cpdf_read_validator.cpp.Henrique Nakashima
Reinstating a check that was lost in https://pdfium-review.googlesource.com/c/pdfium/+/15270 Change-Id: Ic0a7fee71aff605127d7e3789cc54b7ddfb9e399 Reviewed-on: https://pdfium-review.googlesource.com/15631 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-10-06Fix a crash in CPDF_ImageRenderer.chromium/3236chromium/3235Lei Zhang
BUG=chromium:770884 Change-Id: Ia609db04b0e596649fbda087290b7da040211f14 Reviewed-on: https://pdfium-review.googlesource.com/15790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-10-05Remove CPVT_SectionInfoDan Sinclair
The CPVT_SectionInfo class only contains a CPVT_FloatRect member. This CL removes the usage of CPVT_SectionInfo and uses the CPVT_FloatRect where needed instead. Change-Id: Ica020466db03282cf2ad9a7051899d74f8aef076 Reviewed-on: https://pdfium-review.googlesource.com/15730 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-10-05Remove unused CPVT_SectionInfo::nTotalLinesDan Sinclair
The nTotalLines member is set but never used. Removed. Change-Id: Iab59e0954fcdbab665cc477397a94cde66e6087e Reviewed-on: https://pdfium-review.googlesource.com/15710 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove CPVT_SectionDan Sinclair
The CPVT_Section only contained a single rect which was used in one place. The place it was used never used the variable it assigned it too. Removed. Change-Id: I5c3fccff4fad6deca4945e301bffb5348692b23c Reviewed-on: https://pdfium-review.googlesource.com/15675 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove unused methods from CPDF_VariableText::Iterator.Dan Sinclair
This CL removes methods from CPDF_VariableText::Iterator which are never called. Change-Id: I8652320f0e6576e39e7636ce9941e1f148eb9cec Reviewed-on: https://pdfium-review.googlesource.com/15674 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove CPVT_WordPlace from CPVT_SectionDan Sinclair
Parameter was set but never used. Removed. Change-Id: I4bbda0ef7a94e156092e7ac10ae6b9a6fd6713e7 Reviewed-on: https://pdfium-review.googlesource.com/15673 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove CPVT_WordPropsDan Sinclair
Only one of the props was being used and that prop always had the same value. This CL removes CPVT_WordProps. Change-Id: I8cf64f0e9b80c5af18b8fc40ef7b602ffeec7f93 Reviewed-on: https://pdfium-review.googlesource.com/15672 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove unused CPVT_SecPropschromium/3234Dan Sinclair
The CPVT_SecProps were assigned but never accessed. Removed. Change-Id: I2ed15f44dc7a428261e729fc7a835885257d4807 Reviewed-on: https://pdfium-review.googlesource.com/15671 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove unused parametersDan Sinclair
Remove unused params from CPDF_VariableText methods. Change-Id: Ia02f99ea84f0c29e9f674a2cb837b422de390d33 Reviewed-on: https://pdfium-review.googlesource.com/15670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Make GIF decoder more standards complaintRyan Harrison
Fixed issue with unit tests that was causing raw data to be backwards and reverted related LSB -> MSB change that was introduced due to this. If global palette not set then the background colour index should be 0. Check that background colour index is valid when global palette exists. Check if transparency index is valid for the palette of the frame it is being applied to. BUG=chromium:770337 Change-Id: I5d9b648f45bbb4c93218664a7035e4d01dbeb627 Reviewed-on: https://pdfium-review.googlesource.com/15453 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-05Move CPDF_RenderOptions members to privateDan Sinclair
This CL moves the members of CPDF_RenderOptions to be private members and adds accessor methods as needed. Change-Id: Ie91665ff53ae00cc4c53741d089d375503fabe11 Reviewed-on: https://pdfium-review.googlesource.com/15531 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove friend from CPDF_ApSettingsDan Sinclair
This CL removes the friend class from CPDF_ApSettings and makes the needed methods public. Change-Id: I062004d619676b31648f49c9d18a8595874e3c57 Reviewed-on: https://pdfium-review.googlesource.com/15532 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove friends from form codeDan Sinclair
This CL removes the friends from CPDF_FormControl and CPDF_InterForm and adds accessors and moves methods to public as needed. Change-Id: I9d18c9158b1499ca935964b5f9dbd937f0806163 Reviewed-on: https://pdfium-review.googlesource.com/15533 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove friends from CPDF_VariableTextDan Sinclair
This CL removes the friend class items from CPDF_VariableText and adds accessor and makes methods public as needed. Change-Id: Ic54732b25e9879c39a2276a89580cf42d3b3947f Reviewed-on: https://pdfium-review.googlesource.com/15534 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Cleanup CPDF_RenderStatusDan Sinclair
This CL removes friend classes and moves public members to be private in the CPDF_RenderStatus class. Change-Id: Icdd6291bb8c1e5f43386d4a939b1eeaa16b8886d Reviewed-on: https://pdfium-review.googlesource.com/15530 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove CPDF_Object friendsDan Sinclair
This CL removes the friends from CPDF_Object and adds accessors as needed. The m_GenNum was moved to a private member as none of the overriding classes needed access. Change-Id: If23a1a6752dea31eb80669a36694973f3c581123 Reviewed-on: https://pdfium-review.googlesource.com/15470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove friends from CXML_ElementDan Sinclair
This CL removes the friends from CXML_Element and adds accessors as needed. Change-Id: I4f76935caa753a063bef4ff2d043273ae4e14e14 Reviewed-on: https://pdfium-review.googlesource.com/15535 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Remove CPDF_CMapParser friendsDan Sinclair
This CL removes the friends from CPDF_CMapParser. The two needed methods have been moved from private statics to public methods on the class. Change-Id: Ida76aa8748435e089874d9ef9c6545527b175561 Reviewed-on: https://pdfium-review.googlesource.com/15454 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-05Fix Null-dereference READ in CPDF_Dictionary::GetIntegerFor.Artem Strygin
Bug: chromium:771858 Change-Id: Ief40de384921f943a40e8154b67d83ae6e7ed915 Reviewed-on: https://pdfium-review.googlesource.com/15490 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-04Remove friends from CPDF_TextObjectchromium/3233Dan Sinclair
This CL removes the friends from CPDF_TextObject and adds accessor methods as needed. Change-Id: I68d18297640b46113df79f58bea50b77dac89d39 Reviewed-on: https://pdfium-review.googlesource.com/15455 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Remove CPDF_CMap friendsDan Sinclair
This CL removes the friends from CPDF_CMap and adds accessors for the needed items. Change-Id: Icf7b3e639c0904209f7db80c9460146cd29dd78a Reviewed-on: https://pdfium-review.googlesource.com/15452 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-10-04Make CPDF_TransferFunc members privateDan Sinclair
This CL moves the member variables of CPDF_TransferFunc to be private from public and adds accessors as needed. Change-Id: Ib5158721bbe833727b333da794d774f17e4fdea7 Reviewed-on: https://pdfium-review.googlesource.com/15451 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Make CPDF_FontGlobals members privateDan Sinclair
This CL makes the embedded maps and the cmap manager private to CPDF_FontGlobals and adds accessor methods as needed. Change-Id: I50350fcfad5428defe5e68d9d3b29e8961e66e9f Reviewed-on: https://pdfium-review.googlesource.com/15412 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-10-04Remove CFX_CRTFileAccessDan Sinclair
The CFX_CRTFileAccess class was only used in one place and only provided one method. That method was folded back into the caller and the class removed. Change-Id: I5e670474244a9ec037b6d099d67bd5091cac7ff4 Reviewed-on: https://pdfium-review.googlesource.com/15410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Fix Heap-use-after-free in CPDF_SecurityHandler::~CPDF_SecurityHandler.Artem Strygin
The CPDF_SecurityHandler contains unowned reference to "ID" array, which is owned by main trailer. Main trailer is owned by CPDF_Parser::m_TrailerData To fix this issue set m_TrailerData before m_pSecurityHandler(CPDF_SecurityHandler) in CPDF_Parser members list. Bug: chromium:771479 Change-Id: I38413ba16b1454ac775c8a07b126fa3b86714c1b Reviewed-on: https://pdfium-review.googlesource.com/15430 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-04Improve readability for CPDF_LinearizedHeader.Artem Strygin
Change-Id: Ic564139cd8b14d2a8a2a5b4a70251b398753e50f Reviewed-on: https://pdfium-review.googlesource.com/13830 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-04Unify parsing of cross ref table v4.Artem Strygin
We can use 'Prev' value of first-page cross-reference table trailer for load main cross-reference table, instead of 'T' value of Linearized header (Offset of first entry in main cross-reference table). This is better solution, because this is allow us check entry count in main cross-ref table and unify loading of main cross-ref table with loading methods of non linearized document. See PDF specification: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf#678 (page 678, Example 3/part 3) Change-Id: I59dcf3c73a0fb561221ded78e827e40535dbd717 Reviewed-on: https://pdfium-review.googlesource.com/13810 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-04Simplify CPDF_DataAvail::ParseIndirectObjectAtArtem Strygin
Change-Id: I072df58730f323bb5d77d180382ea209cf47f930 Reviewed-on: https://pdfium-review.googlesource.com/13832 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Unify CPDF_HintsTable.chromium/3232Artem Strygin
Break relationship from CPDF_DataAvail for CPDF_HintsTable. Change-Id: If3e6d4910dd368742f095c05adb122ab08c0d804 Reviewed-on: https://pdfium-review.googlesource.com/15270 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Improve CPDF_SecurityHandler code style.Artem Strygin
Make m_pEncryptDict as constant value. Change-Id: I4f65578e936eae5bd6afe9bfed20da3ab8e20de3 Reviewed-on: https://pdfium-review.googlesource.com/15350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>