Opened 18 years ago

Closed 18 years ago

#2670 closed defect (fixed)

encode_dxa: Suspect behaviour

Reported by: eriktorbjorn Owned by: Kirben
Priority: high Component: Tools
Version: Keywords:
Cc: Game:

Description

Since there have been some recent reports about encode_dxa claiming PNG files were not as expected on some systems, I looked a bit closer at it, and there's one thing that's puzzling me:

We call read_png_file() from within a loop. The first time we call it, neither 'image' nor 'palette' are initialized, so they may or may not be NULL.

Therefore, if read_png_file() fails the first time, we'll either get the "8-bit 256-color" warning, or we'll try and free at least one invalid pointer.

If read_png_file() succeeds, and 'palette' was automatically initialized to an invalid pointer, a new palette will be allocated, and things will work as expected, I guess. But if 'palette' was automatically initialized to NULL, it will not allocate a new palette, and then we'd get that "8-bit 256-color" warning.

At least, that's what I think would happen. I'm not all that familiar with libpng, and I don't want to experiment with it without discussing it with Kirben...

Ticket imported from: #1504440. Ticket imported from: bugs/2670.

Change History (5)

comment:1 by eriktorbjorn, 18 years ago

Owner: set to Kirben

comment:2 by johndoe123, 18 years ago

Definitely an error with my initial code and a bug.

comment:3 by sev-, 18 years ago

Priority: normalhigh

comment:4 by sev-, 18 years ago

Raising priority. This is a release-critical bug.

comment:5 by Kirben, 18 years ago

Resolution: fixed
Status: newclosed
Summary: TOOLS: Suspect behaviour in encode_dxaencode_dxa: Suspect behaviour
Note: See TracTickets for help on using tickets.