Closed Bug 206312 Opened 22 years ago Closed 22 years ago

16 color bmp not recognized (attachments of bug 196977)

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mnyromyr, Assigned: neil)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

[carrying over remaining issues from bug 204994 after the crash is fixed.]

With 2003-05-19-04, the 16 color BMPs attached to bug 196977 
(http://bugzilla.mozilla.org/attachment.cgi?id=116919&action=view
 http://bugzilla.mozilla.org/attachment.cgi?id=116921&action=view )
do not display properly, an error page is shown instead:
"The image “[URL from above]” cannot be displayed, because it contains errors."
Both 256 color BMPs display correctly (AFAICT).

This is regression that goes back at least to 2003-04-10, where the loading of
*any* of these four BMPs crashes Mozilla (-> see bug 204994), whereas in
2003-04-04, *all four* BMPs are displayed correctly.

Be sure to have your cache cleared before testing this bug!
We hit the if in here and therefore return a failure:
(around line 584 in nsBMPDecoder.cpp)
                                if (mAlphaPtr + mStateData > mAlpha + mBIH.width) {
                                    // We can work around bitmaps that specify one
                                    // pixel too many, but only if their width
is odd.
                                    mStateData -= mBIH.width & 1;
                                    if (mAlphaPtr + mStateData > mAlpha +
mBIH.width) {
                                        return NS_ERROR_UNEXPECTED;
Attached patch Proposed patchSplinter Review
The padding calculation didn't work for RLE4 because the data is in pixels, not
bytes. Truth table for padding calculation begins:
Pixels	RLE8(1) RLE4(2)
1(=>0)	Yes	Yes
2(=>1)	No	Yes
3(=>2)	Yes	No
4(=>3)	No	No
(etc) so after I subtract 1, the No entries will have the appropriate bit set.
Attachment #123873 - Flags: superreview?(tor)
Attachment #123873 - Flags: review?(cbiesinger)
Comment on attachment 123873 [details] [diff] [review]
Proposed patch

thanks a lot for figuring this out, r=biesi, but please add the table of your
last comment as a comment in the file.
Attachment #123873 - Flags: review?(cbiesinger) → review+
-> neil who made the patch
Assignee: cbiesinger → neil.parkwaycc.co.uk
OS: Windows 2000 → All
Hardware: PC → All
Comment on attachment 123873 [details] [diff] [review]
Proposed patch

sr=tor, but definitely add that table as a comment.  I get the feeling
you're being too clever with the logic there, but not sure an unfolded
version would be much clearer.	Probably worth asking for 1.4 approval
for this.
Attachment #123873 - Flags: superreview?(tor) → superreview+
Comment on attachment 123873 [details] [diff] [review]
Proposed patch

Low risk patch to fix a regression caused by a fix to a crasher bug. Only
affects some RLE4 bitmaps.
Attachment #123873 - Flags: approval1.4?
Comment on attachment 123873 [details] [diff] [review]
Proposed patch

a=mkaply for checkin to 1.4
Attachment #123873 - Flags: approval1.4? → approval1.4+
Fix checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: