Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: pdf/pdfium/pdfium_api_string_buffer_adapter.h

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile cleanup and fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pdf/pdfium/pdfium_api_string_buffer_adapter.h
diff --git a/pdf/pdfium/pdfium_api_string_buffer_adapter.h b/pdf/pdfium/pdfium_api_string_buffer_adapter.h
index 7b45cbe36a800f63a2b7acd5ed0600dc26509064..d3a413cd5a7f426a8617cd803aab2b1689b83cc5 100644
--- a/pdf/pdfium/pdfium_api_string_buffer_adapter.h
+++ b/pdf/pdfium/pdfium_api_string_buffer_adapter.h
@@ -42,8 +42,7 @@ class PDFiumAPIStringBufferAdapter {
template <typename IntType>
void Close(IntType actual_size) {
- base::CheckedNumeric<size_t> unsigned_size = actual_size;
- Close(unsigned_size.ValueOrDie());
+ Close(base::checked_cast<size_t>(actual_size));
}
private:
@@ -88,8 +87,7 @@ class PDFiumAPIStringBufferSizeInBytesAdapter {
template <typename IntType>
void Close(IntType actual_size) {
- base::CheckedNumeric<size_t> unsigned_size = actual_size;
- Close(unsigned_size.ValueOrDie());
+ Close(base::checked_cast<size_t>(actual_size));
}
private:

Powered by Google App Engine
This is Rietveld 408576698