12 Commits

Author SHA1 Message Date
Tom Sepez
4fab2ee66f Opt more testing/ sub-directories into unsafe buffers.
Remove the per-directory suppression, and suppress individual lines in
the files originated by PDFium. Help to avoid new unsafe usage from
being added in any future CLs.

Change-Id: I6b8591ecbf74c4857a02c6f4c28167bde0ce890d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/149130
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2026-06-04 16:58:35 -07:00
Tom Sepez
309d5e9238 Convert remaining code to google_style_ members
Bug: 42271580
Change-Id: I59f78f0cb432c49e9b2ab5169215d6fbb4d8cf87
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130830
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2025-04-21 11:30:15 -07:00
Tom Sepez
d94fd720a0 Remove spurious includes of <string.h>.
<string.h> should be banished as its functions are unsafe.

-- Fix IWYU in header files moving some inclusions from .cpp file.
-- Convert include to stdddef.h/stdint.h if size_t or uint*_t types
   used directly in file.

Change-Id: If39d62d67f8f2cf3d78b5d3603fd14d9d697db35
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118913
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
2024-05-09 21:07:00 +00:00
Tom Sepez
fb6e355743 Mass convert memcpy() to FXSYS_memcpy().
The FXSYS_ form requires callers to specify UNSAFE_BUFFERS(). Most
affected files are already in the pdfium_unsafe_buffers_paths.txt
suppression file. Other usage is hand-patched with TODO()s to
investigate safety.

Change-Id: I8c14d9c38b76455c201b5d2fdf1becad3f18730c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118371
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2024-05-07 18:15:23 +00:00
Lei Zhang
9108588e63 Move remaining code out of third_party/base and into core/fxcrt
Bug: pdfium:2127
Change-Id: I6958fd117a550a8c46a43265ee46370bd1615f38
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116851
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2024-02-22 00:49:57 +00:00
Lei Zhang
f36006cdf4 Move third_party/base/numerics to core/fxcrt/numerics
Move this directory and shorten the pdfium::base nested namespace to
namespace pdfium.

Bug: pdfium:2127
Change-Id: Ie65bc4c3e69e672ff04e2af0218b6f9fc1584d03
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116671
Reviewed-by: Thomas Sepez <tsepez@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2024-02-17 00:56:24 +00:00
Lei Zhang
4da226a072 Change GetFileContents() test utility to return a vector
Instead of returning a std::unique_ptr, with a separate out-parameter
for the size, change GetFileContents() to just return a std::vector.
Because it is only used for reading data files in tests,
GetFileContents() should never have to read an empty file. Therefore, it
can use an empty vector to indicate failure, and not have to wrap the
vector in an optional.

Change-Id: I485551e2ed4c47e98f4535cf91bbf6bff1ca99bb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/113452
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
2023-11-10 20:15:43 +00:00
Lei Zhang
bee35d5e59 Avoid using NOTREACHED() in test code
Switch from NOTREACHED() to NOTREACHED_NORETURN(), or convert
unreachable conditionals into CHECKs.

Bug: pdfium:2008
Change-Id: Ic32de9e76ad07603251ed2a734ba8f8277e586a9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/107751
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-06-08 18:14:01 +00:00
K. Moon
832a694e52 Update old-style copyright headers
Updates old-style copyright headers to the new style, by removing "All
rights reserved." Also inserts "The" before "PDFium Authors", which is
required by both styles.

Mechanically generated by this command:
  PATTERN='Copyright \([0-9]\+\) \(The \)\?PDFium Authors. All rights reserved.'
  git grep -l "$PATTERN" \
  | xargs sed "s/$PATTERN/Copyright \1 The PDFium Authors/" -i''

Fixed: pdfium:1884
Change-Id: I6f781d811df8839e2e21b85f716529b813828bcd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100371
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
2022-10-31 20:11:31 +00:00
Lei Zhang
306320700e Add third_party/base/check.h and notreached.h.
Split part of logging.h into check.h and notreached.h, just like in
Chromium. Change many files that directly call
CHECK()/DCHECK()/NOTREACHED(), but not other logging.h macros, to
include check.h and/or notreached.h instead.

Bug: pdfium:1594
Change-Id: Ide80bd66257f5f267863c36ad0268bbb63225742
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74275
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2020-10-02 01:57:54 +00:00
Lei Zhang
b3be4a14de Use span in TestLoader.
Also change |EmbedderTest::loader_| to unique_ptr.

Change-Id: Ib9d42b6eada6716809b46b1bb8585c4c5f4d6df0
Reviewed-on: https://pdfium-review.googlesource.com/c/49990
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2019-02-05 22:11:07 +00:00
Lei Zhang
d50bdff5f5 Move TestLoader into testing/test_loader.h.
Change-Id: Ifb3bfcf574fe3a2ee34946172850b19aa0534a39
Reviewed-on: https://pdfium-review.googlesource.com/c/49911
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2019-02-05 19:42:33 +00:00