Closed Bug 857876 Opened 11 years ago Closed 11 years ago

Decoders sometimes not shut down when not storing source data

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23
Tracking Status
firefox22 + fixed
firefox23 + fixed

People

(Reporter: seth, Assigned: joe)

References

Details

Attachments

(1 file)

So I can't help but notice that we make calculations similar to the following all over the place in RasterImage:

      aImg->mDecodeRequest->mBytesToDecode = aImg->mSourceData.Length() - aImg->mBytesDecoded;

However, when we aren't storing source data, mBytesDecoded just keeps growing, while mSourceData.Length() stays constant (I believe store just enough data in there to get us through the size decode phase and then never write anything else in.) This is _ultra bad_. mBytesToDecode is unsigned, for example, and ends up wrapping around to a very large number once mBytesDecoded gets larger than mSourceData.Length(), which it rapidly does. There are many other calculations which clearly don't work correctly either.

Frankly I'm a bit puzzled as to how we're able to limp along despite this problem when we aren't storing source data!
I made an attempt to fix this naively by adding an mSourceBytes field which records the true number of bytes and switching all of the calculations over to use that, but that caused a number of issues that I wasn't able to quickly resolve. Joe, I think you might be able to fix this problem faster than I can.
Bug 856602 provides a good test case.
Blocks: 716140
Flags: needinfo?(joe)
Assignee: nobody → joe
Turns out this should actually not happen in practice; I removed some code previously that I should've kept and adapted. Patch coming up.
Flags: needinfo?(joe)
I'm crossing my fingers that this fixes other crashes, like bug 861552. I definitely was able to reproduce assertion failures in some cases when trying to reproduce that bug, and can't any more.
Attachment #737618 - Flags: review?(seth)
Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=d5055a412f69
Summary: mSourceData.Length() - mBytesDecoded doesn't seem to do what RasterImage wants it to do → Decoders sometimes not shut down when not storing source data
Comment on attachment 737618 [details] [diff] [review]
shutdown the decoder when data finished if we're not storing source data

Review of attachment 737618 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. The first couple of times I tried this with http://www.shioda-dcom.co.jp/shiocame/ the mJPEG stopped refreshing with a broken image, which led me to do a bunch of investigation, but at this point I *think* there's no problem and it was just a server-side issue.
Attachment #737618 - Flags: review?(seth) → review+
Could also have been bug 791258.
https://hg.mozilla.org/mozilla-central/rev/baec6e6659a8
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
This appeared to resolve a crash noted in bug 861595, although I can't really make this bug block that one since the main topic of bug 861595 is different.
Comment on attachment 737618 [details] [diff] [review]
shutdown the decoder when data finished if we're not storing source data

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 716140
User impact if declined: Crashes
Testing completed (on m-c, etc.): On m-c for 10 days.
Risk to taking this patch (and alternatives if risky): Not terribly risky. 
String or IDL/UUID changes made by this patch: None
Attachment #737618 - Flags: approval-mozilla-aurora?
Attachment #737618 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: