Add parsing of pxfm boxes#1176
Conversation
| assert(p_manager != 00); | ||
| (void)p_pxfm_header_size; | ||
|
|
||
| opj_read_bytes(p_pxfm_header_data, &l_value, |
There was a problem hiding this comment.
there should be cautious sanitfy checks in that function that p_pxfm_header_size is large enough, otherwise fuzzy testers will trigger crashes with malformed boxes
| "Mismatch between num comps and PXFM number of channel \n"); | ||
| return OPJ_FALSE; | ||
| } | ||
| jp2->pixel_format = (opj_jp2_pixel_format_t*) opj_malloc(jp2->numcomps * sizeof( |
There was a problem hiding this comment.
in the event (likely illegal) that there are 2 PFXM boxes, this will cause a memory leak. An error should likely be emitted if pixel_format is already allocated
There was a problem hiding this comment.
pixel_format should be tested against NULL
There was a problem hiding this comment.
opj_calloc() should be used so that all members are 0 initialized
| jp2->pixel_format[Channel_index].pixel_format_type = ((OPJ_UINT16) l_value) & | ||
| 0xF000; | ||
|
|
||
| if (jp2->pixel_format[Channel_index].pixel_format_type == 0 || |
There was a problem hiding this comment.
given the above masking, it is not possible to have pixel_format_type being 0 or 4...
| } opj_jp2_comps_t; | ||
|
|
||
|
|
||
| typedef enum { |
There was a problem hiding this comment.
this enumeration type appears to be unused ?
This PR adds the parsing of pxfm boxes defined in 15444-2:2004/Amd.3:2015.
I'm not sure about the design of the opj_jp2_pixel_format_values_t. I have been thinking about using an Union instead of a Struct, as the standard is only defining either mantissa, exponent or number of fractionnal bits.