Issue 82970 - Do not crash when loading too big pictures
Summary: Do not crash when loading too big pictures
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: OOo 2.3
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 2.3.1
Assignee: pmladek
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-25 11:51 UTC by pmladek
Modified: 2009-07-20 14:54 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Test tiff picture. (223.28 KB, image/tiff)
2007-10-25 11:53 UTC, pmladek
no flags Details
Test PNG file (2.44 KB, image/png)
2007-10-25 11:55 UTC, pmladek
no flags Details
Proposed fix. (4.76 KB, patch)
2007-10-25 11:56 UTC, pmladek
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description pmladek 2007-10-25 11:51:52 UTC
I'll attach two malformed pictures with wrong dimensions. OOo tried to allocate
too much memory and crashed.

I'll also attach a proposed fix. Here are some more details about it:

+ svtools/source/filter.vcl/filter/filter.cxx

        + the changes in this file are enough to fix the crash with the tiff
          file.
        + OOo read malformed informations and tried to allocate too much memory


+ goodies/source/filter.vcl/itiff/itiff.cxx
+ goodies/source/filter.vcl/itiff/makefile.mk

        + adds more try/catch stuff to the itiff reader
        + note the second hunk for itiff.cxx; it fixes evident mistake caused
          by the last change; the following code did not make sense:

                               if ( !nNumStripByteCounts )
                                        nNumStripByteCounts = 0;

+ vcl/unx/source/gdi/salbmp.cxx
+ vcl/unx/source/gdi/makefile.mk

        + fixes the problem when it reads wrong dimmensions and tries to alloc 
          too big Bitmap in TIFFReader::ReadTIFF:

                aBitmap = Bitmap( Size( nImageWidth, nImageLength ), 
                                  nDstBitsPerPixel );
Comment 1 pmladek 2007-10-25 11:53:38 UTC
Created attachment 49150 [details]
Test tiff picture.
Comment 2 pmladek 2007-10-25 11:55:15 UTC
Created attachment 49151 [details]
Test PNG file
Comment 3 pmladek 2007-10-25 11:56:04 UTC
Created attachment 49152 [details]
Proposed fix.
Comment 4 pmladek 2007-10-25 12:58:08 UTC
It would be great to get it in for OOo-2.3.1.

The fix is in CWS pmladek07 now.

Kendy, could you please do the QA?
Comment 5 ooo 2007-10-25 13:06:09 UTC
@Sven: could you review the changes, please?
Comment 6 thb 2007-10-25 14:11:25 UTC
I'd rather keep the fix from salbmp.cxx out - because there really is no working
error reporting in place for VCL objects. So, I guess it's better to have an
exception fly out of vcl here, rather than hiding the error in an empty bitmap
(which then leads to all kinds of bugs at other places - the least of it saving
empty bitmaps to files).

Or, if you need it: implement proper error reporting for the SalBitmap.
Comment 7 thb 2007-10-25 14:13:23 UTC
.
Comment 8 sven.jacobi 2007-10-25 14:20:19 UTC
I agree with thb, the vcl changes should be removed, but there is nothing
against the other changes in goodies and svtools, they are ok.
Comment 9 pmladek 2007-10-26 10:50:44 UTC
Thanks for the valuable feedback. I agree.

I have removed the vcl part from the CWS. It should be fine now.
Comment 10 pmladek 2007-10-26 11:18:07 UTC
As discussed with pl on irc, I have opened the new issue #82997 for the vcl
part. It would be needed for a proper handling of the PNG file.

I have also opened the issue #82995 for the strange behavior of the new operator.
Comment 11 kendy 2007-10-26 13:30:02 UTC
After improvements based on the above comments that I've reviewed in the CWS 
setting to VERIFIED.
Comment 12 kendy 2007-10-26 13:30:32 UTC
Setting milestone.
Comment 13 thorsten.ziehm 2009-07-20 14:54:28 UTC
This issue is closed automatically and wasn't rechecked in a current version of
OOo. The fixed issue should be integrated in OOo since more than half a year. If
you think this issue isn't fixed in a current version (OOo 3.1), please reopen
it and change the field 'Target Milestone' accordingly.

If you want to download a current version of OOo =>
http://download.openoffice.org/index.html
If you want to know more about the handling of fixed/verified issues =>
http://wiki.services.openoffice.org/wiki/Handle_fixed_verified_issues