Skip to content

Commit

Permalink
[NaCl SDK] nacl_io: Fix use-after-free bug in html5fs
Browse files Browse the repository at this point in the history
nacl_io::Path::Part returns a temporary string. The code that hashes the path
to create a phony ino calls this, and stashes a pointer to the memory.

The real issue with nacl_io_demo is that the quota was too low. I've upped it
to 5 megs now.

BUG=478230
R=sbc@chromium.org

Review URL: https://codereview.chromium.org/1062463004

Cr-Commit-Position: refs/heads/master@{#326850}
  • Loading branch information
binji authored and Commit bot committed Apr 24, 2015
1 parent ad6f502 commit ccbe99a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function $(id) {

// Called by the common.js module.
function domContentLoaded(name, tc, config, width, height) {
navigator.webkitPersistentStorage.requestQuota(1024 * 1024,
navigator.webkitPersistentStorage.requestQuota(5 * 1024 * 1024,
function(bytes) {
common.updateStatus(
'Allocated ' + bytes + ' bytes of persistant storage.');
Expand Down
5 changes: 2 additions & 3 deletions native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ ino_t Html5Fs::HashPath(const Path& path) {

// Apply a running DJB2a to each part of the path
for (size_t segment = 0; segment < path.Size(); segment++) {
const char *ptr = path.Part(segment).c_str();
size_t len = path.Part(segment).length();
hash = HashPathSegment(hash, ptr, len);
const std::string& part = path.Part(segment);
hash = HashPathSegment(hash, part.c_str(), part.length());
}
return hash;
}
Expand Down

0 comments on commit ccbe99a

Please sign in to comment.