bryancall opened a new pull request, #14147:
URL: https://github.com/apache/trafficserver/pull/14147

   RecMessageReadFromDisk() trusted the offsets stored in records.snap. It read 
the header from the start of the file instead of after the version bytes, so 
every header field was shifted; the restore worked only because the second read 
happened to put the whole message at the front of an oversized buffer. Nothing 
checked the element links or the string offsets in each record either, so a 
truncated or corrupt snapshot could lead the restore outside the buffer.
   
   The header is now read from where RecSnapFileWrite() puts it. It must be 
complete, with o_start at the end of the header and o_end inside the file. The 
message is then read in one piece, and its header must match the one that was 
checked. RecMessageUnmarshalNext() requires each element to fit inside the 
message and to start after the previous element's header and record, and each 
string to end inside the message, before it turns an offset into a pointer. A 
bad header is ignored the way a missing snapshot is. A bad element stops the 
restore with a warning, which now names records.snap rather than records.stat.
   
   Adds test_RecMessage.cc: a round trip, five corrupt headers, a truncated 
header, and five corrupt elements and string offsets.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to