google / sawbuck

Automatically exported from code.google.com/p/sawbuck
107 stars 40 forks source link

Invalid pointer dereferenced when creating a trace file. #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the WriteTraceFileHeader() function in trace_file_writer.cc the header 
pointer gets initialized to point to the top of the buffer being used by the 
VectorBufferWriter for serializing the variable length portion of the header.

After writing the variable length part of the header, the code tries to update 
the header with the total length, and tries to align the writer to the page 
size.

The problem is that writing the variable length part of the header may have 
caused the underlying buffer memory (managed by a vector) to have been 
reallocated. The header pointer may now be pointing to the wrong memory region.

The header pointer should be reset before adjusting the header size and 
aligning the stream to a page boundary.

Original issue reported on code.google.com by rog...@chromium.org on 15 May 2012 at 7:27

GoogleCodeExporter commented 8 years ago
Fixed in the following CL.

http://codereview.appspot.com/6197088

Original comment by rog...@chromium.org on 25 May 2012 at 2:20