Closed
Bug 424333
Opened 17 years ago
Closed 16 years ago
crafted gif file will crash firefox [XError: 'BadAlloc (insufficient resources for operation)']
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: hanno, Assigned: vlad)
References
(Blocks 1 open bug, )
Details
(Keywords: crash, platform-parity)
Attachments
(5 files, 4 obsolete files)
(deleted),
image/gif
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
joe
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.12) Gecko/20080212 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8.1.12) Gecko/20080212 Firefox/2.0.0.12
Sam Hovecar created the fuzzing tool zzuf and published a number of samples on it's page:
http://sam.zoy.org/zzuf/
the lol-firefox.gif file still crashes current firefox on my system.
Reproducible: Always
Reporter | ||
Comment 1•17 years ago
|
||
Comment 2•17 years ago
|
||
Doesn't crash for me with SM trunk (1 day old) or Firefox 3b4.
Reporter: Could you try it again with a Firefox3 Beta build ?
(you can install it in a different directory )
Reporter | ||
Comment 3•17 years ago
|
||
3.0b4 gives the same result:
hanno@laverne /tmp/firefox $ ./firefox --sync
The program 'firefox-bin' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
(Details: serial 66009 error_code 11 request_code 53 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Updated•17 years ago
|
Component: General → ImageLib
Keywords: crash
Product: Firefox → Core
QA Contact: general → imagelib
Version: unspecified → Trunk
Comment 4•17 years ago
|
||
This fixes my branch debug build...
I'm applying the limit we have in nsImageGTK::Init():
http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/gfx/src/gtk/nsImageGTK.cpp&rev=1.152&root=/cvsroot&mark=181-184#175
to every gdk_pixmap_new() call site.
Updated•17 years ago
|
Status: UNCONFIRMED → NEW
Component: ImageLib → GFX
Ever confirmed: true
Keywords: pp
QA Contact: imagelib → general
Summary: crafted gif file will crash firefox → crafted gif file will crash firefox [XError: 'BadAlloc (insufficient resources for operation)']
Comment 5•17 years ago
|
||
Assignee: nobody → mats.palmgren
Status: NEW → ASSIGNED
Attachment #311249 -
Flags: superreview?(vladimir)
Attachment #311249 -
Flags: review?(vladimir)
Assignee | ||
Comment 6•17 years ago
|
||
Hrm; we probably should fix cairo, but there should already be code inside Thebes to limit image size.. I can take a look and see why that's not being hit. In the meantime, I'll poke cworth and point them at this and see what they think about doing this in Cairo proper.
Comment 7•17 years ago
|
||
After applying the "Trunk patch, rev. 1" I still crash after ~5 seconds when loading the gif (attachment 310964 [details].)
Comment 8•17 years ago
|
||
(In reply to comment #7)
> After applying the "Trunk patch, rev. 1" I still crash after ~5 seconds when
> loading the gif (attachment 310964 [details].)
Cancel that -- it does seem to fix the crash after all. I think I was running the wrong build when it crashed before. Sorry about that.
Comment 9•17 years ago
|
||
Same as rev. 1 with an addition to fix bug 427385:
There are two calls to gdk_pixmap_new() in gfx/thebes/src/gfxPlatformGtk.cpp
that needs to be fixed in a similar way.
Attachment #311249 -
Attachment is obsolete: true
Attachment #313977 -
Flags: superreview?(vladimir)
Attachment #313977 -
Flags: review?(vladimir)
Attachment #311249 -
Flags: superreview?(vladimir)
Attachment #311249 -
Flags: review?(vladimir)
Comment 10•17 years ago
|
||
Requesting blocking1.9 since there is a low risk patch and with every
crash there is potential dataloss for the user.
Flags: blocking1.9?
Assignee | ||
Comment 11•17 years ago
|
||
There's a fix in progress for this on the cairo list, but wouldn't block 1.9 for it. However, I think we can avoid the bug on our end with the fixes in gfxXlibSurface and gfxPlatformGtk; I'll look at those shortly.
Flags: wanted1.9.0.x+
Flags: blocking1.9?
Flags: blocking1.9-
Comment 12•17 years ago
|
||
I tested attachment #313977 [details] [diff] [review] with some minor updates (this attachment).
With it, I noticed:
- Firefox doesn't crash anymore :-)
- The image region is not (re-)drawn :-(
I think we need some works for this bug.
Comment 13•17 years ago
|
||
(In reply to comment #12)
> - The image region is not (re-)drawn :-(
Oops! Sorry, the redraw problem is for bug 427385 (on PNG images). On GIF images, it doesn't happened.
Comment 14•16 years ago
|
||
Updated•16 years ago
|
Attachment #313977 -
Attachment description: Trunk patch, rev. 2 → Branch 1.9.0 patch, rev. 2
Updated•16 years ago
|
Attachment #326232 -
Flags: superreview?(vladimir)
Attachment #326232 -
Flags: review?(vladimir)
Comment 15•16 years ago
|
||
vlad did this get fixed upstream?
Comment 16•16 years ago
|
||
Why no tests for this?
Comment 17•16 years ago
|
||
Attachment #326232 -
Attachment is obsolete: true
Attachment #331580 -
Flags: superreview?(vladimir)
Attachment #331580 -
Flags: review?(vladimir)
Attachment #326232 -
Flags: superreview?(vladimir)
Attachment #326232 -
Flags: review?(vladimir)
Comment 18•16 years ago
|
||
(In reply to comment #12)
> Created an attachment (id=318131) [details]
> Updated trunk patch, rev. 2
>
> I tested attachment #313977 [details] [diff] [review] with some minor updates (this attachment).
> With it, I noticed:
>
> - Firefox doesn't crash anymore :-)
> - The image region is not (re-)drawn :-(
This is interesting.
XCreatePixmap fail -> cario_surface_create_in_error (NO_MEMORY) (cario_surface_create_in_error doesn't have something like CAIRO_INT_STATUS_UNSUPPORTED) ->xlib backend composite fail as NO_MEMORY
The result is _cairo_surface_composite won't fallback to _cairo_surface_fallback_composite for NO_MEMORY.
I noticed some websites have a huge gif as background. That would be a big problem for Fx 3 on Linux and Solaris.
I hope we can get the fix into 1.9.0 branch.
Comment 19•16 years ago
|
||
vlad,
your commit of
http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=2cf82eaf0d08e68b787bb0792da97e73d8d4ce38
solved the issue with no redraw problem.
But your other commit
http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=d756a4d6323d23cecb928822cdac7528859e7cf3
totally broke the drawing.
I don't know how to reproduce the "UNSUPPORTED loop", you're trying to fix.
If you want to reproduce the drawing issue, apply your 2 patches onto mozilla-central, and change XLIB_COORD_MAX to a very small value, say 80.
Then you can reproduce it with http://www.mozilla.org.
Comment 20•16 years ago
|
||
BTW: the second commit's comment doesn't match the code
the comment is "[xlib] check for too-large surface size in create similar to avoid UNSUPPORTED loop"
but the code change is for _cairo_xlib_surface_clone_similar.
If NO_MEM is returned here, it won't fallback to image surface or _cairo_surface_fallback_clone_similar.
Assignee | ||
Comment 21•16 years ago
|
||
Hm, what do you mean by broke the drawing? If nothing is getting drawn, that's intentional; there isn't anything we can really do if we get to that point. However, we should be (even before) trying a smaller interest rectangle from the image.
The problem is that if xlib_surface_create_similar_with_format returns NULL and thus clone returns UNSUPPORTED, in some cases we'll end up going through a fallback path and eventually getting back to calling clone_similar again... thus leading to an infinite loop and eventually running out of stack. (It can be reproduced with the cairo large-source.c test.)
I'll test though and see what's happening in the actual calling path that mozilla's calling.
Comment 22•16 years ago
|
||
Yes, nothing is getting drawn. But I can't agree it is our intention.
The browser window is not over 32767 x 32767 (even it is we could have a way to handle it.), so we can always fallback to image surface safely.
The gif is displayed well on Mac, and with Firefox 2 on Linux. Why not Firefox 3 with cairo?
We got different results because we're using different test case.
If _cairo_surface_create_similar_scratch() got a large width or height,
other->backend->create_similar (other, content, width, height); will fail (other->backend is XLIB)
then it fallbacks to image surface, and everything is fine.
But if the width, height is small, but the pattern is huge, _cairo_surface_create_similar_scratch() still returns xlib surface,
then it will be a infinite loop between _cairo_surface_fallback_clone_similar and _cairo_paint.
It's fixable. But I don't have a reasonable patch yet.
Updated•16 years ago
|
Flags: blocking1.9.0.3?
Updated•16 years ago
|
Flags: blocking1.9.0.3? → blocking1.9.0.3+
Updated•16 years ago
|
Flags: blocking1.9.0.4+ → blocking1.9.0.5+
Comment 23•16 years ago
|
||
Any update here? It's been over a month since the last comment...
Assignee | ||
Comment 24•16 years ago
|
||
Here's the Gecko side of this patch. Avoids the BadAlloc crash for this and similar bugs.
Doesn't do anything for actual display of the large images, but that should be a separate bug.
Attachment #344529 -
Flags: review?(pavlov)
Updated•16 years ago
|
Assignee: mats.palmgren → vladimir
Assignee | ||
Comment 26•16 years ago
|
||
Comment on attachment 344529 [details] [diff] [review]
add checks to gecko side as well
Switching r? over to joe
Attachment #344529 -
Flags: review?(pavlov) → review?(joe)
Updated•16 years ago
|
Attachment #344529 -
Flags: review?(joe) → review+
Assignee | ||
Comment 28•16 years ago
|
||
Gecko-side patches checked in. With the recent changes in the cairo version that's been upgraded, we -might- now get correct rendering of large images under X. We should probably add a reftest for this.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Updated•16 years ago
|
Whiteboard: [needs 1.9.0 patch? wontfix for 1.9.0?]
Comment 29•16 years ago
|
||
We're not going to take this fix on the 1.9.0 branch due to risk.
Flags: blocking1.9.0.5+ → blocking1.9.0.5-
Assignee | ||
Updated•16 years ago
|
Attachment #313977 -
Attachment is obsolete: true
Attachment #313977 -
Flags: superreview?(vladimir)
Attachment #313977 -
Flags: review?(vladimir)
Assignee | ||
Updated•16 years ago
|
Attachment #331580 -
Attachment is obsolete: true
Attachment #331580 -
Flags: superreview?(vladimir)
Attachment #331580 -
Flags: review?(vladimir)
Updated•16 years ago
|
Product: Core → Core Graveyard
Updated•16 years ago
|
Component: GFX → GFX: Thebes
Product: Core Graveyard → Core
QA Contact: general → thebes
Comment 38•15 years ago
|
||
FWIW, this is the cairo patch
http://cgit.freedesktop.org/cairo/commit/?id=2cf82eaf0d08e68b787bb0792da97e73d8d4ce38
plus attachment 344529 [details] [diff] [review] in this bug, plus a check that 'solid_picture'
is valid, backported to 1.9.0. It seems to fix this bug and bug 390768
on the 1.9.0 branch.
Comment 42•15 years ago
|
||
is the patch in 1.9.0? If so, should whiteboard say wontfix ?
Comment 43•15 years ago
|
||
We're not going to take this on 1.9.0 per comment 29.
Flags: wanted1.9.0.x+ → wanted1.9.0.x-
Whiteboard: [needs 1.9.0 patch? wontfix for 1.9.0?]
Comment 44•15 years ago
|
||
Hi,
Sorry to revive this bug but, using Firefox 3.5.5, it just happened on my Fedora 11 system.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc11 Firefox/3.5.5
$ uname -r
2.6.30.9-96.fc11.i586
The image that froze my system was this 21600 x 21600 JPEG (11.5MB) http://veimages.gsfc.nasa.gov/7103/world.topo.bathy.200404.3x21600x21600.C2.jpg
Got the image from this site: http://visibleearth.nasa.gov/view_rec.php?id=7103
On a Windows Vista system, it seems that Firefox refuses to display the image complaining that it is invalid or corrupt.
Please look it up.
Thanks.
Comment 45•15 years ago
|
||
Works fine on Fedora 12/firefox-3.5.6. I've got a message about broken image.
Comment 46•15 years ago
|
||
Martin, I confirm your result on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.6) Gecko/20091216 Fedora/3.5.6-1.fc11 Firefox/3.5.6
It seems that the latest FFox updates fixed the issue.
Thanks everybody!
You need to log in
before you can comment on or make changes to this bug.
Description
•