summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-29[CFI] Enable type generalization for LCMSVlad Tsyrklevich
Control Flow Integrity [1] indirect call checking verifies that function pointers only call valid functions with a matching type signature. This condition can be too strict, a common form of 'abstraction' relies on function pointers being cast to generalize argument pointer types to void*. In LCMS these failures occur because of casts of function pointers called as both _cmsInterpFn16 (cmsInterpFunction.Lerp16) and _cmsOPTeval16Fn (as an argument to _cmsPipelineSetOptimizationParameters) types making it difficult to refactor out easily. Instead, enabling the type generalization build config weakens the type checking performed for CFI-icall to accomodate this common type of casts. [1] https://www.chromium.org/developers/testing/control-flow-integrity Bug: 785442 Change-Id: Ib42fb1b4e152d5042b170698c2707ebb9e0cc1ee Reviewed-on: https://pdfium-review.googlesource.com/19250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-28Remove CollectionSize from fpdfppo.chromium/3280Dan Sinclair
Bug: pdfium:774 Change-Id: Id13f051bdab8970d469b51a48b1946b6dc86d7dd Reviewed-on: https://pdfium-review.googlesource.com/19631 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28Remove CollectionSize from fpdf_flatten.Dan Sinclair
Bug: pdfium:774 Change-Id: Ie733da2852d2721ef8007aa55d32ffa9537efb70 Reviewed-on: https://pdfium-review.googlesource.com/19630 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28Remove CollectionSize from string_view_templateDan Sinclair
Bug: pdfium:774 Change-Id: Id993864c4ae009e686c62e7be13e2db5d8cb4170 Reviewed-on: https://pdfium-review.googlesource.com/19572 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-28Remove CollectionSize from JBig2_ContextDan Sinclair
Bug: pdfium:774 Change-Id: Ie7674ac55dea6284a0d974cef107ef357197a06b Reviewed-on: https://pdfium-review.googlesource.com/19610 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-28Convert from character stream to visible text indices in GetTextRyan Harrison
Most of the API methods FPDFText operate on indices in terms of the underlying stream of characters. This stream includes non-printing control characters, which are not part of the visible text. The majority of files do not appear to have these hidden characters so there is a 1:1 correspondence between them. When they are present conversion needs to occur to make sure that GetText doesn't attempt to retrieve for a span that is out of range. BUG=chromium:788103,chromium:788220 Change-Id: I4c9fa403ea65754ba94e3f15ded49fe0641e9db5 Reviewed-on: https://pdfium-review.googlesource.com/19550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28[XFA] Use default values to optionalsDan Sinclair
When accessing the margin data for a widget, the Inset values can come back as empty optionals. Those would only get values if there was a border data node present. If there is no border data node, we need to default the optional value. Bug: chromium:788246 Change-Id: Id3d5b76e8dc9d391aaa0d0440bf6ee2e2636fcdc Reviewed-on: https://pdfium-review.googlesource.com/19671 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28[XFA] Fix reading off end of name listDan Sinclair
When walking the Node name list, we need to verify the element returned is not the end element, not just if the element is not null. Bug: chromium:789113 Change-Id: I04c33a8f2066891e6031035e469c677c404fd724 Reviewed-on: https://pdfium-review.googlesource.com/19670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28Fix PDF fuzzers memory limitNicolas Pena
This CL reduces the memory limit in pdf_codec_jbig2_fuzzer. Note that MSAN requires the limit to be lower than the actual bot usage limit. In the testcase, we get OOM just after CFX_DIBitmap::Create. It also increases the limit in xfa_codec_fuzzer.h Bug: 784155 Change-Id: I6fc8d9533ca7dc2b19bf84b9eac23284e05b1e6d Reviewed-on: https://pdfium-review.googlesource.com/19571 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-27Make ConvertBuffer_* voidchromium/3279Nicolas Pena
This CL makes the helper methods 'ConvertBuffer_'* in CFX_DIBSource void since they always succeed. Change-Id: I55dd714bec5ccc3695cd0bbebcf978d767acc53a Reviewed-on: https://pdfium-review.googlesource.com/19650 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CFX_GifContext::GetFrameNum to size_tDan Sinclair
This CL removes the CollectionSize and updates call locations as needed. Bug: pdfium:774 Change-Id: I813c500b3a17a194407ceb1304252b9b16fe1779 Reviewed-on: https://pdfium-review.googlesource.com/19590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Add helpers to get attribute informationDan Sinclair
This CL adds helpers to CXFA_Node to get the type of an attribute and the default value for a given attribute. Change-Id: I8bf41f568fe1da650fb3df4232b63d2e48038e07 Reviewed-on: https://pdfium-review.googlesource.com/19330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Fold XFA_GetAttributeByName into CXFA_Node::NameToAttributeDan Sinclair
This CL removes the xfa_utils helper and does the work directly in CXFA_Node. Change-Id: I4f7cac9cb6d2a53ac5627f50a2f066f79fc22a31 Reviewed-on: https://pdfium-review.googlesource.com/19290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CPDF_StructTree to size_tDan Sinclair
This CL removes the use of CollectionSize from CPDF_StructTree and uses size_t in the callers. Bug: pdfium:774 Change-Id: I860a51a533642c949c497ca26e74ba064a8aa9ba Reviewed-on: https://pdfium-review.googlesource.com/19530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Change FPDF_GetText to return "" when asked to get 0 charactersRyan Harrison
BUG=chromium:788103 Change-Id: I8ebdbc78eb14c358d7ac019b96de4828e6071b79 Reviewed-on: https://pdfium-review.googlesource.com/19350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-27Prepend ++ in CFX_DIBSourceNicolas Pena
In this CL, we do some nit cleanup and change many var++ to ++var in CFX_DIBSource. Change-Id: I2379e6e15688cbde68415adc47b01114ad0785c1 Reviewed-on: https://pdfium-review.googlesource.com/19570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-27Convert CPDF_StructElement::CountKids to size_tDan Sinclair
This CL changes CountKids to not used CollectionSize and returns size_t directly. Callers updated as needed. Bug: pdfium:774 Change-Id: I8862218e62cd13be9473fa8116afd29cd3afde04 Reviewed-on: https://pdfium-review.googlesource.com/19510 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_RenderStatusDan Sinclair
Bug: pdfium:774 Change-Id: I4996f5526884c33d92df964045bd5467c392df5e Reviewed-on: https://pdfium-review.googlesource.com/19490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_CharPosListDan Sinclair
Bug: pdfium:774 Change-Id: I7ebbcb17374b4117f92b94edbd8bcba18efe6313 Reviewed-on: https://pdfium-review.googlesource.com/19470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from FPDF_DataDecodeDan Sinclair
Bug: pdfium:774 Change-Id: I3fcde6fba46d21affa63d79fab2d83f47c9c5f84 Reviewed-on: https://pdfium-review.googlesource.com/19450 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CPDF_TextObject to not use CollectionSizeDan Sinclair
This CL updates various methods in CPDF_TextObject to return or received size_t values. Callers have been updated as needed. Bug: pdfium:774 Change-Id: Id72511bc74637c6261add39f5414c9a4b8390b82 Reviewed-on: https://pdfium-review.googlesource.com/19430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Convert CPDF_ClipPath::Get{Path|Text}Count to size_tDan Sinclair
This CL updates the various call sites to use size_t instead of other types. Bug: pdfium:774 Change-Id: Id8b75728b61c0ca1b15bc815831c885d33374f7b Reviewed-on: https://pdfium-review.googlesource.com/19410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Add some helpers for attribute lookupDan Sinclair
This CL adds helpers to CXFA_Node to convert from strings to attributes and from attributes to their string names. A static_assert was added to make sure the list of attributes is the same size as the attribute data so the checks can be removed. Change-Id: Idebc65021d71f604bcf498e4cf42252af00d802b Reviewed-on: https://pdfium-review.googlesource.com/19270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove use of CollectionSize from CPDF_CMapParserDan Sinclair
Bug: pdfium:774 Change-Id: Ie24d0741f8c8d7988166aeb4b9ce87491993d30c Reviewed-on: https://pdfium-review.googlesource.com/19390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Generate XFA node classesDan Sinclair
This CL adds concrete classes for each of the XFA Node types. Change-Id: Ieac8e2fcd5d13c61daa27fc63e3d80abb7aa7a29 Reviewed-on: https://pdfium-review.googlesource.com/18271 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-23Roll pdfium/third_party/freetype/src/ 8f5568bfc..bec14f688 (5 commits)chromium/3278Nicolas Pena
https://chromium.googlesource.com/chromium/src/third_party/freetype2.git/+log/8f5568bfc4fd..bec14f688925 $ git log 8f5568bfc..bec14f688 --date=short --no-merges --format='%ad %ae %s' 2017-11-22 ewaldhew * src/psaux/psft.c (cf2_setGlyphWidth): Check format before setting. 2017-11-22 ewaldhew [psaux] Fix CFF advance widths. (#52466) 2017-11-15 vtsyrklevich * include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type. 2017-11-14 madigens Use Adobe hinting engine for `light' hinting of both CFF and Type 1. 2017-11-09 yuri_levchenko * CMakeLists.txt: Add `DISABLE_FORCE_DEBUG_PREFIX' option. Created with: roll-dep pdfium/third_party/freetype/src R=dsinclair@chromium.org,npm@chromium.org,thestig@chromium.org Bug: pdfium:941 Change-Id: I00579a3e26d9cabce7032e0b538de95a1029bac7 Reviewed-on: https://pdfium-review.googlesource.com/19310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-23Cleanup CXFA_WidgetDatachromium/3277Dan Sinclair
This CL cleans up return values, out-params and changes simple methods to boolean checks where possible in CXFA_WidgetData. Change-Id: I29daa67993730f3e9d61cb6fdf918a886cc9120e Reviewed-on: https://pdfium-review.googlesource.com/19230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-22Rename CXFA_WidgetData::GetAccess to ::IsOpenAccessDan Sinclair
We never use ::GetAccess to get the value in general, just to see if it's set to Open or not. This CL makes the usage clearer. Change-Id: I0e978a8b8e642c7441ab2ceb8062f672ceea7d55 Reviewed-on: https://pdfium-review.googlesource.com/19210 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-22Cleanup CXFA_ValueDataDan Sinclair
This CL makes the methods const and uses return values instead of out-params. Change-Id: If760cd8c10d8f3a94dd3e13c46200cb6738a4d5a Reviewed-on: https://pdfium-review.googlesource.com/19150 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-22Cleanup CXFA_ValidateDataDan Sinclair
This CL removes out-params in favour of returns; Makes params const; Cleans up return types. Change-Id: I2b7c237130a99859b08af0486a95b4c6f6974f62 Reviewed-on: https://pdfium-review.googlesource.com/19130 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-22Call FreeLibrary() in CGdiplusExt.chromium/3276Lei Zhang
BUG=pdfium:939 Change-Id: I4204965bd8b81bea3c485fcb27adfa212cce4e69 Reviewed-on: https://pdfium-review.googlesource.com/19190 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-22Change CPDF_ContentMark to return size_t for counts.Lei Zhang
Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove dead CPDF_ContentMark code.Lei Zhang
Change-Id: Ic552a652856ca231f3d2077c76a20d5916adb3c1 Reviewed-on: https://pdfium-review.googlesource.com/19170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove some pointless assignments to "".Lei Zhang
Or change them to clear(). Change-Id: Ia9e3e1f0d74b948cec3f8df85d205f830ac9216c Reviewed-on: https://pdfium-review.googlesource.com/19172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Cleanup CXFA_TextDatachromium/3275Dan Sinclair
This CL makes GetContent const. Change-Id: I0dc3f939d265f4605a1bfb14020ca938d47f5602 Reviewed-on: https://pdfium-review.googlesource.com/19112 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Avoid passing pointers by reference in core.Lei Zhang
This gets rid of most core/ non-const ref passing, either by passing by pointer-to-pointer instead, or by returning std::pair. Change-Id: Id7bdc355a1a725a05f9fa2f1e982ca8c975beef1 Reviewed-on: https://pdfium-review.googlesource.com/19030 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_SubmitDataDan Sinclair
This CL cleans up the CXFA_SubmitData methods by using returns instead of out-params, sets the correct return types and makes the methods const. Change-Id: I41fe8f59e450ca444b64c291ac4a0a199c7ad0cf Reviewed-on: https://pdfium-review.googlesource.com/19111 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_StrokeDataDan Sinclair
This CL fixes return types and makes methods consts. Change-Id: I97da09a491d10760d6adf4efcc0557130cf8b405 Reviewed-on: https://pdfium-review.googlesource.com/19110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_ScriptDataDan Sinclair
This CL cleans removes out params, makes methods const and moves the XFA_ScriptDataType into CXFA_ScriptData. Change-Id: I5a51a0eddc3608577a387472911000daa479af0f Reviewed-on: https://pdfium-review.googlesource.com/19090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_ParaDataDan Sinclair
This CL fixes the return types and makes the CXFA_ParaData methods const. Change-Id: Ifb63b46e826d9741682d992d7fc1ee37c772fb41 Reviewed-on: https://pdfium-review.googlesource.com/19070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_OccurDataDan Sinclair
Make methods const, use return instead of out params. Change-Id: Idfdae8df5cd74ba0bce08c05a6fc34b168d25f79 Reviewed-on: https://pdfium-review.googlesource.com/19050 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_LineDataDan Sinclair
Make methods const and return the correct types. Change-Id: Icaa1c17d611a69227f67ea398e4b3cc17bc1004b Reviewed-on: https://pdfium-review.googlesource.com/19011 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Cleanup CXFA_ImageDataDan Sinclair
This CL removes the second constructor parameter which is always true and removes all related conditionals. The methods have been changed to const and return instead of using out parameters. Change-Id: Id6d2aa533a212e961e3b8169eef57b7e868d503e Reviewed-on: https://pdfium-review.googlesource.com/19010 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-21Cleanup CXFA_FontDataDan Sinclair
This CL makes the various methods const and removes out params from CXFA_FontData. Change-Id: I85268906a2454c23b73d5724c2556758246791cb Reviewed-on: https://pdfium-review.googlesource.com/18970 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-21Cleanup CXFA_FillDataDan Sinclair
This CL makes the CXFA_FillData methods const and splits them into retrieving fill information and fill colour methods. Change-Id: Ie407be87c631ea68efa0934d9a98e412ed1eb922 Reviewed-on: https://pdfium-review.googlesource.com/18950 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Add {Byte/Wide}String::Trim().Lei Zhang
So callers no longer have to call str.TrimLeft(); str.TrimRight(); Change-Id: If931eaa8d891f487b9618ebbeee5ee294e807846 Reviewed-on: https://pdfium-review.googlesource.com/18990 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Clean up CJS_PublicMethods.Lei Zhang
Change-Id: I0f488814f4345661226cd4f2ce8dc68739d17bb2 Reviewed-on: https://pdfium-review.googlesource.com/18730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Make CXFA_CaptionData methods constDan Sinclair
Change-Id: I132fc2e7a2f441ed0bdcfad16b32c65ad4433a1b Reviewed-on: https://pdfium-review.googlesource.com/18930 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Make CXFA_CalculateData methods constDan Sinclair
Change-Id: Ic939cd7dd49aab7db59244eed6e0513bf2ca7e69 Reviewed-on: https://pdfium-review.googlesource.com/18914 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-21Remove unused CXFA_BoxData methodsDan Sinclair
Unused, removed. Change-Id: I5e4fec6f5737546f5c022af594e137d1d86725fd Reviewed-on: https://pdfium-review.googlesource.com/18913 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>