summaryrefslogtreecommitdiff
path: root/xfa/fgas
AgeCommit message (Collapse)Author
2018-04-16Fix UAF in CFGAS_FontMgr::FindFontchromium/3398Ke Liu
Fix an use-after-free issue which was introduced by commit 53279b1dcabae4913f7f0a58e741942e82ab7d59. Bug: chromium:832589 Change-Id: Id7da791c3aa2d71d0a9e56d062069f41b7eb48d1 Reviewed-on: https://pdfium-review.googlesource.com/30570 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-13Move SharedForm check to CPDF_Metadata classdan sinclair
This CL moves code related to shared form detection into the CPDF_Metadata class. This allows us to hide the usage of CXML inside CPDF_Metadata. Change-Id: I547471a2bcc119221565c415a58211c1500cbb3c Reviewed-on: https://pdfium-review.googlesource.com/30370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Make CFX_Font take FX_RECT out params by pointer.Lei Zhang
Change-Id: I6643aaf66bf3e9d53d5afab5c99a5cb7deab3661 Reviewed-on: https://pdfium-review.googlesource.com/30054 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-10Remove CFX_Rect.Lei Zhang
It is rarely used and FX_RECT is the more common integer rect type. Change-Id: I7c5b875321c2d587becedcd058bb3a57fd1f0b61 Reviewed-on: https://pdfium-review.googlesource.com/30053 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-03Re-arrange so inline vectors come last in structs.Tom Sepez
This might make the memory tools more effective in finding OOBs. Change-Id: Id093bb0a88c37954c80d612ac00b5a168e75bdbf Reviewed-on: https://pdfium-review.googlesource.com/29550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-03-27Remove unused FX_TXTRUN::pIdentityDan Sinclair
Unused, removed. Change-Id: I0c7e65224777932e38ca93d81709c8321aecb1c5 Reviewed-on: https://pdfium-review.googlesource.com/29290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-12Remove all usages of FXSYS_iswASCIIalphaRyan Harrison
Instances are either replaced with FXSYS_iswalpha, which calls out to the ICU library to do the proper Unicode operations, or have been converted to a isascii && isalpha pair, if ASCII alpha is actually what was wanted. BUG=pdfium:1035 Change-Id: I971ff639ee1ff818ad08793a1900a8bcbb0a3e04 Reviewed-on: https://pdfium-review.googlesource.com/28450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-03-09Explicitly mark helper methods that only operate on ASCII rangesRyan Harrison
A number of our character helper methods take in wide character types, but only do tests/operations on the ASCII range of characters. As a very quick first pass I am renaming all of the foot-gun methods to explictly call out this behaviour, while I do a bigger cleanup/refactor. BUG=pdfium:1035 Change-Id: Ia035dfa1cb6812fa6d45155c4565475032c4c165 Reviewed-on: https://pdfium-review.googlesource.com/28330 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-06Rename IFX classes in core/fxge to Ifacechromium/3364Dan Sinclair
This CL renames IFX classes in core/fxge to Iface. Change-Id: I137167ddd4ff1563d8002d9501222c27183408cc Reviewed-on: https://pdfium-review.googlesource.com/27990 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-06Rename core/fxcrt IFX files to IfaceDan Sinclair
This CL renames the 3 IFX files in core/fxcrt to Iface instead. Change-Id: I7cee6836650b71bc5c5729a8147fda62f0910fe3 Reviewed-on: https://pdfium-review.googlesource.com/27970 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-16Avoid 100 blank FX_FONTDESCRIPTOR entries.Tom Sepez
Change-Id: Ibaf53ee27eefc692ac4f002c3ab28b7738676b31 Reviewed-on: https://pdfium-review.googlesource.com/26991 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-16m_pEnumerator only ever has one value, indirection not needed.Tom Sepez
Change-Id: Ic1d63e8ef54a820b01d67dbf1dd6f6f72a06b77c Reviewed-on: https://pdfium-review.googlesource.com/26990 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-07Handle removed fonts correctly in GetFontByCodePageRyan Harrison
The existing code has a couple of issues that need to be addressed. First it assumes that for a hash, there will be an entry in the map and blindly calls the [] operator and takes the address of the result. If there isn't an entry for the hash then this will cause a crash. This has been converted to a call to find and returning nullptr, which is the fail result, if it cannot find an entry for the hash. The other issue is that it assumed that the first entry in the vector would be a valid pointer. When removing fonts from the vector, RemoveFont, first nulls out entries. Once all of the entries have been removed from a vector on subsequent calls to RemoveFont, then the vector is removed from the map. Thus the first entry in the vector might not be the correct value to return. This has been changed to a linear scan of the vector for a valid pointer. BUG=chromium:648177 Change-Id: Ife758636545f0d10fb726c243e3e0a5b7c1d1138 Reviewed-on: https://pdfium-review.googlesource.com/25930 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-31Remove handrolled bsearch from FGAS_GetUnicodeBitFieldRyan Harrison
BUG=pdfium:798 Change-Id: I054db94b53fbfabdf5dd860e951bef9c53177ad1 Reviewed-on: https://pdfium-review.googlesource.com/24830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-31Remove handrolled search from GetCodePageFromCharsetRyan Harrison
BUG=pdfium:798 Change-Id: If89c162f8a6c15a8a0f4313fbf4713ee2fde5357 Reviewed-on: https://pdfium-review.googlesource.com/24719 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-30Use unsigned for char widthchromium/3335Nicolas Pena
Bug: 806612 Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1 Reviewed-on: https://pdfium-review.googlesource.com/24410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-01-18Remove more unneeded includes and code from headers.Lei Zhang
Change-Id: I0a07dbc9850bef2184ed35ff04b08385fc1bdd17 Reviewed-on: https://pdfium-review.googlesource.com/22891 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-05Remove unused code from CFX_BreakLineRyan Harrison
Change-Id: I5b1cdeb53fa791f557cde93074f75e8d18c49f17 Reviewed-on: https://pdfium-review.googlesource.com/22330 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-07Add WARN_UNUSED_RESULT to ByteString::Format* methods.Henrique Nakashima
Change-Id: I0caba99cb8e99ea5af49d906b576f580275620bb Reviewed-on: https://pdfium-review.googlesource.com/20570 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-06Fix ps rendering.chromium/3287Henrique Nakashima
Also fix other occurrences that were missed. Bug:pdfium:947 Change-Id: Ic7e909ff9ce3abdf91e8e9ba108c84ad28b2fd65 Reviewed-on: https://pdfium-review.googlesource.com/20472 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-30Run clang-tidy modernize-use-equals-{delete,default} on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' Bug: chromium:778959, chromium:778957 Change-Id: I23e60d3d6c8bc9e8574d425710a0441cb5510d6b Reviewed-on: https://pdfium-review.googlesource.com/19970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-29Remove CollectionSize from fx_bidiDan Sinclair
Bug: pdfium:774 Change-Id: I2056583c270f1bb0046250ce2ec53a2cbe46b893 Reviewed-on: https://pdfium-review.googlesource.com/19672 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Make WideString::{Format|FormatV} staticDan Sinclair
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Refactor CFGAS_FontMgr's Windows implementationNicolas Pena
This CL unifies a bit the public methods of CFGAS_FontMgr. It does so by replacing the multiple maps on the Windows implementation to a single map from hash to font. Also, cloning CFX_Fonts is avoided with the use of SetLogicalFontStyle. These Windows changes are just mimicking other OS's. As a side-effect, some members of CFX_Fonts are now owned so the raw pointers are replaced with unique_ptrs. Change-Id: I576d438572ccbe6c48f8f5cc434d66fc6adba372 Reviewed-on: https://pdfium-review.googlesource.com/18131 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Remove m_bFlagExact from CFX_SubstFontNicolas Pena
This CL removes the single use case from |m_bFlagExact|. This flag allows the PDF viewer to treat a substitute font with a matching name as if it was actually an embedded font, which is wrong. For all substitute fonts, it is important to follow the longer process of first obtaining the unicode from the charcode to then obtain the glyph in the substitute font that corresponds to that unicode. Bug: chromium:781785 Change-Id: Ie5958b43914e0e46334b89b7c2c55c02d0da0c11 Reviewed-on: https://pdfium-review.googlesource.com/17859 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@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-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-28Cleanup CFGAS_GEFont methodsDan Sinclair
Remove unused params, cleanup return values. Change-Id: I9a1bc400e24cdcac982a578242ff0f9de8055775 Reviewed-on: https://pdfium-review.googlesource.com/15070 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@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 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-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-27Move static methods to anonymous namespaceDan Sinclair
This CL moves the static CFGAS_FontMgr methods to the anonymous namespace. Change-Id: I2835099ed9e503ee04daca3012a4ddd278255fdc Reviewed-on: https://pdfium-review.googlesource.com/14830 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@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-26Hide FX_HandleParentPathDan Sinclair
This CL moves FX_HandleParentPath to be a private inner class of CFX_FontSourceEnum_File. Change-Id: I5e2d16c4d78457a28e1833d0b937547019cdece6 Reviewed-on: https://pdfium-review.googlesource.com/14818 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-26Share public part of CFGAS_FontMgr declarationDan Sinclair
This CL moves the public part of the CFGAS_FontMgr declaration to be shared across all platforms. Change-Id: I92e587fe06611c92f72746477775802c2f3b8b57 Reviewed-on: https://pdfium-review.googlesource.com/14817 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-26Move font source into CFGAS_FontMgrDan Sinclair
This CL moves the font source into the font manager so it doesn't need to be stored by each caller (and removes the platform dependant code). The |EnumFonts| method is exposed on the CFGAS_FontMgr so the caller can clear the manager if the enumeration fails. Change-Id: Iecce3d2e09ff01152b7bb79a34fe2b728320da9c Reviewed-on: https://pdfium-review.googlesource.com/14816 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-26Remove font default paramsDan Sinclair
This CL removes some default parameters from the font code. Change-Id: If6f6e09c93474e1e8b7ffaae53eb37dd40c32fab Reviewed-on: https://pdfium-review.googlesource.com/14815 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@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>
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_Observable to ObservableDan Sinclair
This CL renames CFX_Observable to Observable and moves into the fxcrt namespace. The test suite names were updated to ObservedPtr from fxcrt. Bug: pdfium:898 Change-Id: Ia507482bc0a1d6d8bbf12c0c55c4a88f6c8910e2 Reviewed-on: https://pdfium-review.googlesource.com/14615 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Rename CXFA_DefFontMgr to CFGAS_DefaultFontManagerDan Sinclair
This CL removes any XFA requirements on the default font manager and moves it to the fgas/ directory. Some helper methods from CXFA_FontMgr are moved into the fgas/fgas_fontutils.h files. Change-Id: I17ba8dc2bd60085c17d8a3328f6625675a82787f Reviewed-on: https://pdfium-review.googlesource.com/14570 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CXFA_PDFFontMgr to CFGAS_PDFFontMgrDan Sinclair
XFA bits passed into the PDFFontMgr are just used to get the CPDF_Document and the CFGAS_FontMgr. This CL changes the code to pass those two things into the constructor. Then, the fxfa/cxfa_pdffontmgr.* code has been moved to fgas/cfgas_pdffontmgr.* to show it doesn't depend on any of the XFA classes. Change-Id: I21d791869e2a32ffedfd7c87bb3bbd035232d991 Reviewed-on: https://pdfium-review.googlesource.com/14550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-18Remove some unused variables.Lei Zhang
BUG=chromium:760070 Change-Id: Icb2e46da86b6b7e71dae309a015ae1c5301fc931 Reviewed-on: https://pdfium-review.googlesource.com/14230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-15Make static const char* arrays more const.Lei Zhang
Change-Id: I87b5e6cefe973b82b4868e56fc5285c95c53a12b Reviewed-on: https://pdfium-review.googlesource.com/12550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-13Add readme files to some directories.chromium/3215Henrique Nakashima
Change-Id: I2a750c8e46b68dc4870e2dadd2ed3429008e1562 Reviewed-on: https://pdfium-review.googlesource.com/13551 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-06Convert FX_STRSIZE int->size_tRyan Harrison
Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>