Fixup integer conversion logic.

In bc8a64029f898286c3dcad3a6cecdc98ef30b139 we updated the FX_atonum logic
to correctly handle integer overflow. This causes issues when parsing the
Permissions flag of encrypted documents as that flag isn't encoded like other

The Permissions flag is a unsigned value, and has to be treated as such since
the sign bit is always set. The current logic will detect an overflow of the
int value and return 0. The old logic would have detected the overflow and
returned the negative result regardless.

This CL updates the logic to do the string to int conversion as a uint32_t
and then verifies the uint32_t value, if a sign was provided, fits within
the int range, otherwise it converts it to an int and lets it be positive or
negative as needed.


2 files changed
tree: f4a700dfae9f05be766fa54f769fbdd8a3da6755
  1. .clang-format
  2. .gitignore
  3. .gn
  6. DEPS
  11. build_gyp/
  12. build_overrides/
  13. codereview.settings
  14. core/
  15. docs/
  16. fpdfsdk/
  17. fxjs/
  18. infra/
  20. pdfium.gni
  21. pdfium.gyp
  22. public/
  23. samples/
  24. skia/
  25. test/
  26. testing/
  27. third_party/
  28. tools/
  29. xfa.gyp
  30. xfa/



As of 2016-05-04, GN is used to generate build files replacing GYP. GYP support will remain until it is disabled in Chromium and then will be removed from PDFium.

As of 2016-04-28, the Visual Studio toolchain from depot_tools is used as the default Windows toolchain for Googlers. Please set DEPOT_TOOLS_WIN_TOOLCHAIN=0 if you need to use the system toolchain. See Windows development subsection for details.




### Windows development

PDFium uses a similar Windows toolchain as Chromium:

Open source contributors

Visual Studio 2015 Update 2 or later is highly recommended.


Compilation is done through ninja, not Visual Studio.

Google employees


Once you've done this, the toolchain will be installed automatically for you in the step below.



Get the code


mkdir repo
cd repo
gclient config --unmanaged
gclient sync
cd pdfium

## Generate the build files

We use GN to generate the build files and Ninja (also included with the depot_tools checkout) to execute the build files.

gn gen <directory>

If you want to set to out/Debug or out/Release you'll need to export GYP_PDFIUM_NO_ACTION=1 to stop gclient sync from executing GYP and overwriting your build files.

### Selecting build configuration



use_goma = true  # Googlers only.
is_debug = true  # Enable debugging features.

pdf_use_skia = false  # Set true to enable experimental skia backend.

pdf_enable_v8 = true  # Set false to remove Javascript support.
pdf_is_standalone = true  # Set for a non-embedded build.


When complete the arguments will be stored in <directory>/

Building the code

If you used Ninja, you can build the sample program by: ninja -C <directory>/pdfium_test You can build the entire product (which includes a few unit tests) by: ninja -C <directory>.

Running the sample program



There are currently several test suites that can be run:

  • pdfium_unittests
  • pdfium_embeddertests
  • testing/tools/
  • testing/tools/
  • testing/tools/



The current health of the source tree can be found at


There are several mailing lists that are setup:




Contributing code

For contributing code, we will follow Chromium's process as much as possible. The main exceptions is:
