summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2016-08-24Delete unused methods from CFX_RenderDevicenpm
Review-Url: https://codereview.chromium.org/2269203002
2016-08-23Fix stack overflow in object Clone() functionsweili
For some complex objects such as CPDF_Dictionary, CPDF_Array, CPDF_Stream, and CPDF_Reference, Clone() could be executed with infinite recursion to cause the stack overflow. Fix this by checking already cloned objects to avoid recursion. BUG=pdfium:513 Review-Url: https://codereview.chromium.org/2250533002
2016-08-23Make indirect object holder private.dsinclair
This CL moves the m_IndirectObjs map to be private to the IndirectObjectHolder. Various bits of code have been updated to use the accessors to the map. This CL fixes the issue with the last time this landed by removing the objnum check from GetIndirectObject() which appears to have caused the crashes. Review-Url: https://codereview.chromium.org/2275703002
2016-08-23IndirectObjectHolder API updatesdsinclair
This Cl updates the names of the methods in the indirect object holder to better reflect their usage. The m_LastObjNum is made private and a setter added. Review-Url: https://codereview.chromium.org/2275593002
2016-08-23Fix one more integer overflow in ReadPageHintTable().thestig
BUG=637119 Review-Url: https://codereview.chromium.org/2274723002
2016-08-22Generate default AP stream for text annotation.jaepark
This patch generates a default AP stream for text annotation. The AP stream only draws a symbol, which represents the presence of text annotation at the point. Also, roll DEPS for testing/corpus to afbac94 to test text annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2270493002
2016-08-22Fix more integer overflows inside ReadPageHintTable().thestig
BUG=637119 Review-Url: https://codereview.chromium.org/2268693003
2016-08-22Revert of Move parser pointer to CPDF_Document (patchset #6 id:100001 of ↵dsinclair
https://codereview.chromium.org/2253723002/ ) Reason for revert: Causing asan issues. See crbug.com/639451. Original issue's description: > Move parser pointer to CPDF_Document > > The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and > CFDF_Document. The CPDF document requires the parser and the CFDF document > does not. This cl moves the parser pointer up to CPDF_Document. > > Committed: https://pdfium.googlesource.com/pdfium/+/260f5fbf3553a96fa49b029cc050220039c30e2a TBR=tsepez@chromium.org,thestig@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. Review-Url: https://codereview.chromium.org/2266033002
2016-08-19Move CFX_FaceCache to its own filenpm
Moved ScopedFontTransform from fx_ge_text namespace to fx_font Moved some arrays used by both CFX_Font and CFX_FaceCache from fx_ge_text to inside CFX_Font class Review-Url: https://codereview.chromium.org/2263623002
2016-08-19Avoid signed overflow in CPDF_ToUnicodeMap::StringToCode()tsepez
It was intended to be unsigned in the first place, and we're perfectly happy with the overflow as long as it is no longer undefined behaviour. BUG=638489 Review-Url: https://codereview.chromium.org/2258053003
2016-08-19Add a fuzzer for CPDF_HintTables.thestig
BUG=636559 Review-Url: https://codereview.chromium.org/2255083004
2016-08-19Apply structure packing to FXTEXT_CHARPOS to save space.npm
BUG=pdfium:562 Review-Url: https://codereview.chromium.org/2257313002
2016-08-18Add llvm fuzzer for CPDF_PSEnginetsepez
Put class definition into its own header file so fuzzer can find it. Fix a pair of div by 0s immediately hit by the fuzzer. Review-Url: https://codereview.chromium.org/2253193003
2016-08-18Move CFX_UnicodeEncoding and CFX_UnicodeEncodingEx to their own files.npm
Review-Url: https://codereview.chromium.org/2260533002
2016-08-17Split fx_font into multiple files, part 1.npm
Moved classes CFX_FontCache and CFX_AutoFontCache into a separate file. Review-Url: https://codereview.chromium.org/2246223002
2016-08-17Move parser pointer to CPDF_Documentdsinclair
The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and CFDF_Document. The CPDF document requires the parser and the CFDF document does not. This cl moves the parser pointer up to CPDF_Document. Review-Url: https://codereview.chromium.org/2253723002
2016-08-17check for null bitmapcaryclark
Recent Skia driver addition of 8 bit src / 8 bit dst workaround needs to check for a nullptr bitmap. R==dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2255763002
2016-08-16Delete m_ExtHandle and RetainFont because they are not being used.npm
CFX_SubstFont::m_ExtHandle is never assigned a value different from nullptr. Similarly, IFX_SystemFontInfo::RetainFont has two implementations. Both of these return nullptr, so this method is not needed. Review-Url: https://codereview.chromium.org/2252833002
2016-08-16Remove two unused members from CPDF_Parsertsepez
Review-Url: https://codereview.chromium.org/2247073005
2016-08-16Hidden annotations should not be drawntonikitoo
Now that PDFium supports drawing of more annotation types, it should also respect the "hidden" flag that annotations might feature. For instance, in IE/Acroread if an annotation is flagged as "hidden" it does not get drawn. CL adds a check for the specific "hidden" flag, not drawing annotation that are flagged with it, in order to match IE + acrobat reader behavior. The "flags" definition can be seen by looking at "/F {value}" syntax in a PDF file source, where {value} is an predefined integer value. Test: PDF files being added in [1]. [1] https://codereview.chromium.org/2239713003/ BUG=62625 Review-Url: https://codereview.chromium.org/2239853002
2016-08-16Rename async to linearized when parsingdsinclair
The parser and document refer to async loading and parsing. The code isn't actually async but loading a linearized PDF. This Cl renames the methods to clarify what the code is doing. The LoadDoc() and LoadLinearizedDoc() methods have been refactored to share a common LoadDocInternal() method. Review-Url: https://codereview.chromium.org/2250163002
2016-08-16Get CPDF_Parser out of the document creation business.tsepez
Precursor to someday using possibly subclassed documents. Review-Url: https://codereview.chromium.org/2248123002
2016-08-15Avoid integer overflows in FXGE_GetGlyphsBBox().thestig
And also CFX_RenderDevice::DrawNormalText(). BUG=637192 Review-Url: https://codereview.chromium.org/2244613002
2016-08-15Fix a potential integer overflow in TT2PDF().chromium/2830thestig
BUG=635438 Review-Url: https://codereview.chromium.org/2248473002
2016-08-15Fix CGdiPrinterDriver::DrawDeviceText() to draw multiple characters.thestig
Previously, Skia generated PDFs would only output one character at a time, but now they output whole strings. Handle this case. BUG=409472 Review-Url: https://codereview.chromium.org/2197553002
2016-08-15Get rid of FX_SMALL_RECT.thestig
Review-Url: https://codereview.chromium.org/2248463002
2016-08-15Use a std::vector in fpdf_font code.thestig
Review-Url: https://codereview.chromium.org/2248453002
2016-08-15add native draw bitmap with alpha maskcaryclark
PDFs draw bitmaps with alpha by supplying an image alpha mask along side the image color data. The alpha mask may not be the same scale as the image data. Skia doesn't have a direct mapping for this draw call, but can come close by using the internal SkCompositeShader class. This scales the alpha mask to match the size of the image data, then puts both in the composite shader to draw. There are more things to do: - Allow Alpha8 or Gray8 to draw scaled to a matching device (blit doesn't work today) Temporary code marked with a TODO implements this functionality. - Refactor PDFium to allow SkComposeShader's components to take a matrix. The latter goal will defer drawing so that PDFium doesn't resize the mask, discarding resolution, before Skia has a chance to record it. Additionally fix drawing text with a negative font size. R=reed@google.com,dsinclair@chromium.org,herb@chromium.org Review-Url: https://codereview.chromium.org/2182763002
2016-08-15Clean up CPDF_HintTables.thestig
Review-Url: https://codereview.chromium.org/2241153002
2016-08-12Avoid an undefined shift in ReadPageHintTable().thestig
Even 39 bits is very generous for the number of bits needed to represent the greatest number of shared object references. BUG=637119 Review-Url: https://codereview.chromium.org/2242723002
2016-08-12fix 617135hong_zhang
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
2016-08-12Make g_LinuxGpFontList be a 2D char array.npm
Review-Url: https://codereview.chromium.org/2240863002
2016-08-11Fix an integer overflow in CStretchEngine constructorweili
When the source bitmap's width and height are large, the multiplication could easily overflow a signed integer. Change to use 'long long' type for calculation to avoid that. BUG=chromium:635663 Review-Url: https://codereview.chromium.org/2240723002
2016-08-11Clean up cfx_fontmapper a littlenpm
Added methods to reduce duplicated code Nit fixes Review-Url: https://codereview.chromium.org/2239703003
2016-08-11Relax a check in CPDF_HintTables.thestig
CPDF_HintTables::ReadSharedObjHintTable() unnecessarily constraints a FX_FILESIZE value to an int32_t. Relax this check, since the result will be stored in |m_szSharedObjOffsetArray| which is of FX_FILESIZE. Bad values in |m_szSharedObjOffsetArray| will still cause hint table loading to eventually fail. BUG=635565 Review-Url: https://codereview.chromium.org/2230883003
2016-08-10Minor cleanup of fpdf_cmapsdsinclair
Cleanup some dead code and c-style casts. Review-Url: https://codereview.chromium.org/2235743003
2016-08-10Clean up CPDF_HintTables::LoadHintStream a little.thestig
- Return earlier when possible. - Fail rather than crash on invalid values. Review-Url: https://codereview.chromium.org/2235843002
2016-08-10Move CFX_RenderDevice, CFX_FxgeDevice, and CFX_GraphStateData into their own ↵npm
files. This is the third CL to separate fx_ge into classes, one per file. All fx_ge.h includes had to be replaced with new includes The method definitions for CFX_FxgeDevice were not moved to a single file. These methods are defined in two folders different from fxge/ge, so they were left untouched for now. Review-Url: https://codereview.chromium.org/2223213002
2016-08-09Fix a leak with FPDFPageObj_NewImgeObj().thestig
BUG=pdfium:545 Review-Url: https://codereview.chromium.org/2194393002
2016-08-09Generate default AP stream for ink annotation.jaepark
This patch generates a default AP stream for ink annotation so that ink annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 4119f8e to test ink annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2232553002
2016-08-09Fix typos of the word outer.thestig
Review-Url: https://codereview.chromium.org/2226003003
2016-08-09Generate default AP stream for circle annotation.jaepark
This patch generates a default AP stream for circle annotation so that circle annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 71d1f22 to test circle annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2228093002
2016-08-09Generate default AP stream for square annotation.jaepark
This patch generates a default AP stream for square annotation so that square annotations without AP stream can be displayed. Also, roll DEPS for testing/corpus to 7f07c22 to test square annotations. BUG=62625 Review-Url: https://codereview.chromium.org/2219683002
2016-08-09Fixup various overflow conditionsdsinclair
There were several overflows detected by the PDF from the linked bug. This Cl fixes up the base causes of each of them. BUG=chromium:635473 Review-Url: https://codereview.chromium.org/2226023002
2016-08-08Add CPDF_Array::IsEmpty().jaepark
Using IsEmpty() is more readable than using GetCount() == 0. Review-Url: https://codereview.chromium.org/2226113002
2016-08-08Check if image width or height are zero before proceeding.dsinclair
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
2016-08-08Move CFX_ClipRgn and CFX_PathData into their own files.npm
This is the second CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. CFX_ClipRgn is moved to core/fxge/ge because it is only used in core/fxge. The header for CFX_PathData is left in core/fxge/include since it is used elsewhere. Review-Url: https://codereview.chromium.org/2216853004
2016-08-05Add CPDF_ImageObject::GetImage().thestig
And use it where appropriate. Review-Url: https://codereview.chromium.org/2224623002
2016-08-04Move CFX_GEModule into its own filenpm
This is the first CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. Review-Url: https://codereview.chromium.org/2217663002
2016-08-04Remove unnecessary casting in CPVT_GenerateAP.jaepark
Since CFX_BinaryBuf::GetBuffer() returns uint8_t*, casting to uint8_t* is unnecessary. Review-Url: https://codereview.chromium.org/2218633002