Commit c7d3e64b authored by vogelheim's avatar vogelheim Committed by Commit bot

Fix free-after-free bug in ExternalStreamingStream::ResetToBookmark.

R=jochen@chromium.org
BUG=chromium:470930
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#28700}
parent c984efe6
......@@ -434,10 +434,14 @@ void ExternalStreamingStream::ResetToBookmark() {
pos_ = bookmark_;
// current_data_ can point to bookmark_data_'s buffer.
current_data_ = bookmark_data_.start();
// bookmark_data_* => current_data_*
// (current_data_ assumes ownership of its memory.)
uint8_t* data = new uint8_t[bookmark_data_.length()];
current_data_offset_ = 0;
current_data_length_ = bookmark_data_.length();
CopyCharsUnsigned(data, bookmark_data_.begin(), bookmark_data_.length());
delete[] current_data_;
current_data_ = data;
// bookmark_buffer_ needs to be copied to buffer_.
CopyCharsUnsigned(buffer_, bookmark_buffer_.begin(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment