diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 01:16:18 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 01:16:18 +0000 |
commit | 4c00704f744e1d2ca1be9b7f67501a46452d4e03 (patch) | |
tree | 090a75f219b5bd1b69bd4302955ef7528051c944 /chrome | |
parent | fe00335bb1d7dab7143a3f77cac9526d53f08c7a (diff) | |
download | chromium_src-4c00704f744e1d2ca1be9b7f67501a46452d4e03.zip chromium_src-4c00704f744e1d2ca1be9b7f67501a46452d4e03.tar.gz chromium_src-4c00704f744e1d2ca1be9b7f67501a46452d4e03.tar.bz2 |
Use heap memory intead of stack memory to avoid having to
grow the stack.
BUG=12968
TEST=none
Review URL: http://codereview.chromium.org/215042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/extension_creator.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 00ea023..f49ba75 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -137,11 +137,12 @@ bool ExtensionCreator::SignZip(const FilePath& zip_path, scoped_ptr<base::SignatureCreator> signature_creator( base::SignatureCreator::Create(private_key)); ScopedStdioHandle zip_handle(file_util::OpenFile(zip_path, "rb")); - uint8 buffer[1 << 16]; + size_t buffer_size = 1 << 16; + scoped_array<uint8> buffer(new uint8[buffer_size]); int bytes_read = -1; - while ((bytes_read = fread(buffer, 1, sizeof(buffer), + while ((bytes_read = fread(buffer.get(), 1, buffer_size, zip_handle.get())) > 0) { - if (!signature_creator->Update(buffer, bytes_read)) { + if (!signature_creator->Update(buffer.get(), bytes_read)) { error_message_ = "Error while signing extension."; return false; } @@ -180,12 +181,13 @@ bool ExtensionCreator::WriteCRX(const FilePath& zip_path, fwrite(&signature.front(), sizeof(uint8), signature.size(), crx_handle.get()); - uint8 buffer[1 << 16]; + size_t buffer_size = 1 << 16; + scoped_array<uint8> buffer(new uint8[buffer_size]); int bytes_read = -1; ScopedStdioHandle zip_handle(file_util::OpenFile(zip_path, "rb")); - while ((bytes_read = fread(buffer, 1, sizeof(buffer), + while ((bytes_read = fread(buffer.get(), 1, buffer_size, zip_handle.get())) > 0) { - fwrite(buffer, sizeof(char), bytes_read, crx_handle.get()); + fwrite(buffer.get(), sizeof(char), bytes_read, crx_handle.get()); } return true; |