Opened 16 years ago

Closed 16 years ago

#5179 closed defect (fixed)

QImage takes an int for the number of colors (which means it can only take 2 Mi colors)

Reported by: Erik Hovland <erik@…> Owned by: stuartm
Priority: trivial Milestone: 0.22
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

QImage takes a parameter in its constructor that specifies the number of colors the image can have. That parameter type is an int. Which can only go to 2 Mibi colors. In a few places where QImages are used they are given 4 Mibi colors. Which is an integer overflow value to a constructor. Probably nothing bad is happening. But it is likely better to give the integer max instead of an overflow value.

Attachments (2)

libs_libmyhtv-integer-overflow-in-QImage.patch (2.3 KB) - added by Erik Hovland <erik@…> 16 years ago.
changes the 4Mibi value in the ctor call to the INT_MAX macro from the C library
libs_libmythtv-integer-overflow-in-QImage-ticket-5179.patch (2.0 KB) - added by Erik Hovland <erik@…> 16 years ago.
Same patch, but uses the QT4 ctor and enum

Download all attachments as: .zip

Change History (6)

Changed 16 years ago by Erik Hovland <erik@…>

changes the 4Mibi value in the ctor call to the INT_MAX macro from the C library

comment:1 Changed 16 years ago by stuartm

Resolution: invalid
Status: newclosed

Since this particular constructor doesn't exist in QT4 the correct fix will be applied as part of the QT4 port. In QT4 we use a format enum value instead to specify the colour depth. e.g QImage::Format_RGB32

comment:2 Changed 16 years ago by Erik Hovland <erik@…>

Resolution: invalid
Status: closednew

OK, so the port has happened and this constructor has not changed. So I am reopening the ticket and submitting a patch that uses the QT4 enum based constructor as Stuart mentions.

Changed 16 years ago by Erik Hovland <erik@…>

Same patch, but uses the QT4 ctor and enum

comment:3 Changed 16 years ago by stuartm

Milestone: unknown0.22
Owner: changed from Isaac Richards to stuartm
Status: newassigned

The QT4 port is far from complete. We've converted to QT4 + QT3Support and we're now slowly moving towards full QT4 which would include replacing QT3 only classes/methods with QT4 equivalents.

Thanks for the patch however :)

comment:4 Changed 16 years ago by stuartm

Resolution: fixed
Status: assignedclosed

(In [17059]) Convert QImage constructor to the QT4 format using an enum value to define depth, number of colours and endianness. I didn't use the patch from Eric Hovland as it failed to remove the defunct depth argument, but thanks anyway. Fixes #5179

Note: See TracTickets for help on using tickets.