diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 03:16:23 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 03:16:23 +0000 |
commit | 54d2b618ec3111192511d794d1195866e12b78f6 (patch) | |
tree | a5186baab67aed577d4f3cca467854e1bb6c7b84 /chrome/renderer | |
parent | 8e0176d4a50b29d0e65c6328be58384d2a4ecce3 (diff) | |
download | chromium_src-54d2b618ec3111192511d794d1195866e12b78f6.zip chromium_src-54d2b618ec3111192511d794d1195866e12b78f6.tar.gz chromium_src-54d2b618ec3111192511d794d1195866e12b78f6.tar.bz2 |
Modify content::GetFontTable to allow clients to control what is read.
This will be used in an upcoming PPAPI Font API. This adds an offset, and changes
the semantics so that the function will only read as much data as the client
requests. Before, the function would fail if the buffer wasn't big enough.
BUG=79375
Review URL: https://chromiumcodereview.appspot.com/12433021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/pepper/pepper_flash_font_file_host.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/pepper/ppb_pdf_impl.cc | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chrome/renderer/pepper/pepper_flash_font_file_host.cc b/chrome/renderer/pepper/pepper_flash_font_file_host.cc index b427265..524c227 100644 --- a/chrome/renderer/pepper/pepper_flash_font_file_host.cc +++ b/chrome/renderer/pepper/pepper_flash_font_file_host.cc @@ -57,11 +57,12 @@ int32_t PepperFlashFontFileHost::OnGetFontTable( #if defined(OS_LINUX) || defined(OS_OPENBSD) if (fd_ != -1) { size_t length = 0; - if (content::GetFontTable(fd_, table, NULL, &length)) { + if (content::GetFontTable(fd_, table, 0 /* offset */, NULL, &length)) { contents.resize(length); uint8_t* contents_ptr = reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str())); - if (content::GetFontTable(fd_, table, contents_ptr, &length)) { + if (content::GetFontTable(fd_, table, 0 /* offset */, + contents_ptr, &length)) { result = PP_OK; } else { contents.clear(); diff --git a/chrome/renderer/pepper/ppb_pdf_impl.cc b/chrome/renderer/pepper/ppb_pdf_impl.cc index 0198b19..2454c90 100644 --- a/chrome/renderer/pepper/ppb_pdf_impl.cc +++ b/chrome/renderer/pepper/ppb_pdf_impl.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/metrics/histogram.h" +#include "base/safe_numerics.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" @@ -61,8 +62,8 @@ class PrivateFontFile : public ppapi::Resource { uint32_t* output_length) { size_t temp_size = static_cast<size_t>(*output_length); bool rv = content::GetFontTable( - fd_, table, static_cast<uint8_t*>(output), &temp_size); - *output_length = static_cast<uint32_t>(temp_size); + fd_, table, 0 /* offset */, static_cast<uint8_t*>(output), &temp_size); + *output_length = base::checked_numeric_cast<uint32_t>(temp_size); return rv; } |