summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
AgeCommit message (Collapse)Author
2014-12-12Simplify PDFium by removing code that's not used in the open source repo.John Abd-El-Malek
-remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused R=tsepez@chromium.org Review URL: https://codereview.chromium.org/801913002
2014-12-08Replace manual/error-prone/hard-to-verify arraysize calculations with safe ↵Bruce Dawson
FX_ArraySize macro. pdfium has numerous places where the number of elements in an array is calculated with expressions like: sizeof(cFormats)/sizeof(FX_LPCWSTR) This is suboptimal because it is verbose, it is easy to get wrong, and it cannot be determined through casual inspection whether the code is correct. It will give incorrect results if cFormats is a pointer instead of an array and it will give incorrect results if FX_LPCWSTR is not the type of the array elements. The FX_WSTRC macro in fx_string.h which I fixed was particularly scary because it would silently misbehave if passed a pointer. The FX_ArraySize macro which I have added and started using (taken from arraysize in v8's macros.h) is easier to use and will always give correct results. If passed a pointer it will fail to compile. For this change I only fixed instances of sizeof(FX_LPCWSTR). There appear to be about 150 other places in the pdfium code that could benefit from using FX_ArraySize. R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/729293003
2014-12-08Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this.Bruce Dawson
Since casts to FX_LPCWSTR have been shown to hide bugs I tried removing more of them, targeting those places where a cast was used to force a conversion from CFX_WideString to FX_LPCWSTR, replacing these casts with calls to the newly added .c_str() function. This revealed two places where the cast was hiding a bug -- where ->c_str() was required instead! This removes ~33 FX_LPCWSTR casts and there are ~31 left, many of which will go away in some future change. Also includes this change: Removing unnecessary casts from wchar_t* to wchar_t*, by various names. Original patch from Bruce Dawson(brucedawson@chromium.org) R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/733693003
2014-11-17Removing unnecessary casts from wchar_t* to wchar_t*, by various names.Bruce Dawson
Remove casts that merely cast from wchar_t* to wchar_t*. Sometimes the types or casts are FX_LPCWSTR but the idea is the same. Excess casts can (and have) hidden bugs so removing these may prevent future problems. Original patch from Bruce Dawson(brucedawson@chromium.org) R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/730993002
2014-11-14Correct typo in form fill environment functionsBo Xu
Complementary patch in chromium is in https://codereview.chromium.org/711553003 R=thestig@chromium.org Review URL: https://codereview.chromium.org/700373006
2014-11-14Remove FX_LPCWSTR cast to wchar_t* literalsBo Xu
BUG=https://code.google.com/p/pdfium/issues/detail?id=78 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/726143002
2014-11-14Change from 'this' to L'this' and remove the cast that was hiding this mismatch.Bo Xu
Found by VC++'s /analyze. Warning was: fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. This mismatch has been there as far back as the history goes (to May of this year). It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time. The code has been this way as far back as the git history goes, but that is only to May 2014. Original patch from Bruce Dawson(brucedawson@chromium.org) BUG=427616 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/705503004
2014-10-30For v8 Global Object, do not copy in CJS_Value constructor.Tom Sepez
BUG=425129 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/688303003
2014-09-24Lock page in LoadFXAnnot to prevent unintended page closingBo Xu
BUG=410326 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/594403003
2014-09-22Invoke V8::Initialize() explicitly during V8 setupchromium/2168chromium/2167Jochen Eisinger
BUG=none R=jam@chromium.org Review URL: https://codereview.chromium.org/581413002
2014-09-19Add FPDF_GetSecurityHandlerRevisionBo Xu
Security handler revision number is needed to interpret file permission. BUG=None R=thestig@chromium.org Review URL: https://codereview.chromium.org/589813002
2014-09-08The cause of this issue is that there is an indirect object like '112 0 R' ↵Jun Fang
but no its direct object '112 0 object' in the test pdf file. Without checking the validity, it causes a null pointer when trying to get the direct object by an indirect object. BUG=390781 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/553613003
2014-08-22Fix confusion between length in bytes and length in characters in ↵Tom Sepez
app::response(). I also clean up the code while we are here, rewriting a strange switch statement and tidying whitespace. BUG=406142 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/498773004
2014-08-18Fix a double-free issue in CFX_PathData::~CFX_PathDataJun Fang
In CPDFSDK_InterForm::SubmitFields, the buffer pointed by m_pBuffer is returned and released by the caller. However, it will be released again in the destructor. BUG=401580 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/481733002
2014-08-18Check path point count overflow in DrawThisAppearanceBo Xu
BUG=387969 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/461343003
2014-08-13Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.Tom Sepez
Should there be cases where this fails to compile, it indicates a mistake, either an incorrectly declared overrriden virtual method, or a method that should be declared non-virtual. The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(), and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere, and are removed. Two members are removed that are no longer needed once those methods are removed. R=jam@chromium.org, jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/454983003
2014-08-13Remove try/catch blockBo Xu
BUG=pdfium:28 R=thakis@chromium.org Review URL: https://codereview.chromium.org/472563002
2014-08-12Treat null Parent as no Parent for dictionary objectsBo Xu
To be complient with PDF reference chapter 7.3.7 BUG=402437 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/469573002
2014-08-07Change '>=' back to '>' in extension.h due to bad fixchromium/2122chromium/2121chromium/2120chromium/2119chromium/2118Jun Fang
BUG=400662 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/445303002
2014-08-06Clean up meaningless branch on commented-out code.Chris Palmer
BUG=https://code.google.com/p/pdfium/issues/detail?id=35 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/451483003
2014-08-04Remove unused |m_pEvi| field.Chris Palmer
Edge closer to the goal of building PDFium with the chromium_code configuration. BUG=https://code.google.com/p/pdfium/issues/detail?id=29 R=bo_xu@foxitsoftware.com, thakis@chromium.org Review URL: https://codereview.chromium.org/441763002
2014-08-02Fix buffer size boundary check offset by 1chromium/2117chromium/2116chromium/2115chromium/2114chromium/2113Bo Xu
When newPos == file size, the current block will not be read or Get. If this block is a crucial part of the document (like m_pTrailer), the program will exit with parse error and the document will not be rendered. BUG=None R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/440563003
2014-07-31Fix a few more -Wreorder warnings.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/436483002
2014-07-31Remove CPDFSDK_Annot::ResetAppearance().Nico Weber
It's unused, and it caused a warning about CPDFSDK_Widget::ResetAppearance() failing to override it (since these two unrelated methods had the same name). No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/429483004
2014-07-30Remove a few unused variables, functions, and member variables.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/426763003
2014-07-30Fix a few -Wreorder warnings.Nico Weber
BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/427353003
2014-07-30Add missing braces for aggregate initializers.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/426763004
2014-07-30Attempt to fix some -Woverloaded-virtual warnings.Nico Weber
There are many warnings that look like: error: 'CPWL_RadioButton::OnChar' hides overloaded virtual function [-Werror,-Woverloaded-virtual] virtual FX_BOOL OnChar(FX_WORD nChar); ^ note: hidden overloaded virtual function 'CPWL_Wnd::OnChar' declared here: different number of parameters (2 vs 1) virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); ^ It looks like someone added the nFlag parameter to the methods in CPWL_Wnd at some point and missed to update all overloads This patch attempts to fix this: It adds the parameter to all methods that look like they're trying to overload the base class method, and renames the method in one case where it fairly clearly looks like that it's not supposed to be an overload. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/416383004
2014-07-30Fix the potential integer overflow from 'offset+size' in extension.h and ↵JUN FANG
fpdfview.cpp BUG=397258 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/419063002
2014-07-29Tidy up app::response().Tom Sepez
Follow-up from https://codereview.chromium.org/424883002/ - Remove some stray whitespace. - Fix "else after return". - Remove unused swResponse local. - Treat unexpectedly large responses as errors. BUG= R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/423953002
2014-07-29Fix a few more warnings in chromium_code mode.Nico Weber
No intended behavior change. - Remove more unused variables, functions, member variables. - Put a few constructor initializers in the order they execute in. - Add braces for subobject initializers. - Fix a handful of signed / unsigned comparisons. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/429593005
2014-07-29Remove a few unused variables, functions, and tables.Nico Weber
Found by clang's -Wunused-variable, -Wunused-function, -Wunused-const-variable. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/404653005
2014-07-23Fix potential memory violation in CJS_PublicMethods::StrRTrim()Tom Sepez
BUG=395266 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/411713003
2014-07-23Fix lookahead beyond bounds in CJS_PublicMethods::MakeFormatDate().Tom Sepez
BUG=396255 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/407243003
2014-07-23Fix FPDF_RenderPage 2x zoom in when bBackgroundAlphaNeeded is trueBo Xu
BUG=179413 R=thestig@chromium.org Review URL: https://codereview.chromium.org/410073002
2014-07-18Fix bounds checking in CJS_PublicMethods::MakeRegularDate().Tom Sepez
The function is looking ahead N characters at both its "format" and "value" strings without validating that accesses are in bounds. Add those validations. There are also duplicate checks in the else-branches which re-test the inverse of the if-branch. These are removed for simplicity. I also tidied some stray whitespace in the function while I was at it. BUG=393831 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/395303004
2014-07-18pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.Nico Weber
Calling `delete` on an object of a type that has virtual functions but not a virtual destructor is questionable: Since the object has virtual functions, it likely has subclasses, so if it's deleted through the base pointer and the destructor isn't virtual, the subclass destructor won't be called. In most cases, the classes getting deleted can just be marked final to tell the compiler that it can't possibly have subclasses (this also enables the compiler to generate better code). Two classes didn't have any sub- or superclasses but virtual functions - this doesn't make sense, so make all methods of these classes non-virtual. (Also delete an unused function on one of the two classes.) In one case, a class actually did have a subclass that needs to be deleted virtually, so mark one destructor as virtual. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/370853002
2014-07-17Hook up the default v8::Platform implementation to pdfiumJochen Eisinger
It remains to call the PumpMessageLoop() method at a regular interval, however, since nothing posts to the loop yet, that shouldn't be a problem. BUG=25 R=jam@chromium.org Review URL: https://codereview.chromium.org/374123002
2014-07-16Add a newline at the end of fpdfeditpage.cpp.chromium/2096Nico Weber
Fixes a warning. BUG= TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/395293002
2014-07-14Add support to extract viewer preferenceBo Xu
This change adds the support to extract "NumCopies", "PrintPageRange", "Duplex" viewer preferences for printing. BUG=169120 R=bo_xu@foxitsoftware.com, vitalybuka@chromium.org Review URL: https://codereview.chromium.org/345123002
2014-07-14Fix an out-of-boundary issue for wide stringBo Xu
BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002
2014-07-09Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition (try 2)chromium/2095chromium/2094chromium/2093chromium/2092chromium/2091chromium/2090chromium/2089chromium/2088chromium/2087chromium/2086Lei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/377353002
2014-07-08Revert commit 95c018e2d15ecc3a5bd2a9aab18638316a6d3d46Lei Zhang
Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition BUG=81439 TBR=pkasting@chromium.org Review URL: https://codereview.chromium.org/376043003
2014-07-08Fixes for re-enabling more MSVC level 4 warnings: pdfium/ editionLei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/372383004
2014-07-08Remove custom memory managerBo Xu
BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003
2014-06-30Remove "this==NULL" and adjust corresponding callersBo Xu
BUG= R=thakis@chromium.org Review URL: https://codereview.chromium.org/361553002
2014-06-26Import Chromium base/numerics to resolve integer overflow.Chris Palmer
We'll use this for integer overflows going forward. BUG=382606 R=jam@chromium.org Review URL: https://codereview.chromium.org/349363005
2014-06-23Revert "Import Chromium base/numerics to resolve integer overflow."John Abd-El-Malek
This reverts commit d9713f05fdcecab8428d39034c6b84cd0bbd2920. This is breaking compile.
2014-06-20Import Chromium base/numerics to resolve integer overflow.Chris Palmer
We'll use this for integer overflows going forward. BUG=382606 R=bo_xu@foxitsoftware.com, jschuh@chromium.org Review URL: https://codereview.chromium.org/341533007
2014-06-12Add FPDFPage_SetRotation functionBo Xu
R=jam@chromium.org Review URL: https://codereview.chromium.org/336563004