Closed Bug 1456147 Opened 4 years ago Closed 4 years ago

Assertion failure: !Done(), at mozilla/BufferList.h:191 when IPC fuzzing


(Core :: IPC, defect, P1)




Tracking Status
firefox61 --- fixed


(Reporter: Alex_Gaynor, Assigned: Alex_Gaynor)


(Blocks 1 open bug)



(1 file)

The root cause appears to be that |Data()| on a |PickleIterator| asserts if you're at the end of the buffer, and |ExtractBuffers| doesn't check for that case here:

This is reached via

I'll have a patch up shortly. This is not a sec issue because this is a release assert, just an aggravation to fuzzing efficiency.
I'm not 100% confident this patch is correct; this causes it to not hit the assert, but given the point of BufferList is to have multiple segments, and PickleIterator::Done() only considers the current one, maybe the correct solution is more intelligent.

A critical eye in the review is appreciated.
Comment on attachment 8970250 [details]
Bug 1456147 - do not fail on an assertion error when calling Pickle::ExtractBuffers on an empty iterator;

I spent some time staring at the code.  The key here is IterImpl's [invariant 2][], which is maintained (and release asserted) by the Advance method: the Done() condition won't be true unless it's the end of the last segment.  So, Done() really does mean it's done.

It seems reasonable for ExtractBuffers to return false instead of crashing in this case — it looks like all the other cases in the Pickle reading methods for unexpected end-of-message do the same thing.  (And ExtractBuffers isn't called with length 0.)

As for the assertion in Data(), because I was also wondering if it really makes sense: in theory it's possible that the caller isn't about to do something bad (it could be checking RemainingInSegment() and carefully avoiding the parts of the C spec where accessing 0 bytes at a bad pointer is undefined behavior), but in practice it probably will, so I agree that the assertion should stay.

[invariant 2]:
Attachment #8970250 - Flags: review?(jld) → review+
Keywords: checkin-needed
Pushed by
do not fail on an assertion error when calling Pickle::ExtractBuffers on an empty iterator; r=jld
Keywords: checkin-needed
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.