From 62120b79bbaca7430a8fc7ba0846b0a84f40542d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 4 Feb 2015 10:37:17 -0800 Subject: Prevent base::CheckedNumeric from leaking outside of pdfium. Headers in /include directories should be free of implementation details from third_party. Put the types into a new header outside of /include. Requires https://codereview.chromium.org/902443003/ before a version containing this patch is rolled into chromium. R=jam@chromium.org Review URL: https://codereview.chromium.org/896023003 --- core/src/fxcrt/extension.h | 2 ++ core/src/fxcrt/fx_safe_types.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 core/src/fxcrt/fx_safe_types.h (limited to 'core/src/fxcrt') diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index c23a2e3369..961e0ecf3a 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -7,6 +7,8 @@ #ifndef _FXCRT_EXTENSION_IMP_ #define _FXCRT_EXTENSION_IMP_ +#include "fx_safe_types.h" + class IFXCRT_FileAccess { public: diff --git a/core/src/fxcrt/fx_safe_types.h b/core/src/fxcrt/fx_safe_types.h new file mode 100644 index 0000000000..794e1f19dc --- /dev/null +++ b/core/src/fxcrt/fx_safe_types.h @@ -0,0 +1,17 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FX_SAFE_TYPES_H_ +#define FX_SAFE_TYPES_H_ + +#include // For size_t. + +#include "../../../third_party/numerics/safe_math.h" + +typedef base::CheckedNumeric FX_SAFE_DWORD; +typedef base::CheckedNumeric FX_SAFE_INT32; +typedef base::CheckedNumeric FX_SAFE_SIZE_T; +typedef base::CheckedNumeric FX_SAFE_FILESIZE; + +#endif // FX_SAFE_TYPES_H_ -- cgit v1.2.3