[FFmpeg-devel] [PATCH] tiffdec: support embedded ICC profiles

Lynne dev at lynne.ee
Mon Jan 13 19:50:21 EET 2020


Jan 13, 2020, 16:06 by derek.buitenhuis at gmail.com:

> On 10/01/2020 22:06, Lynne wrote:
>
>> Patch attached.
>>
>> Very widespread, every NASA TIFF image has an ICC profile embedded, and its almost never sRGB, so this is really needed for proper color display.
>>
>
> [...]
>
>> ---
>>  libavcodec/tiff.c | 13 +++++++++++++
>>  libavcodec/tiff.h |  1 +
>>  2 files changed, 14 insertions(+)
>>
>> +    case TIFF_ICC_PROFILE:
>> +        if (count >= INT_MAX || count <= 0)
>> +            return AVERROR_INVALIDDATA;
>>
>
> Should this be > instead of >=?
>

Actually the entire condition needs to be gone. count is uint32_t. The length is already checked below.
Copied this from ff_tadd_shorts_metadata which has an int count.
And the offset value isn't taken into account. TIFF allows the ICC profile to be placed pretty much anywhere within the file (the 32 bit offset points from the start of the file, not the field). So this would only work with files where the ICC profile immediately follows the tag.

Attached a new patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tiffdec-support-embedded-ICC-profiles.patch
Type: text/x-patch
Size: 1963 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200113/9cbc2b4e/attachment.bin>


More information about the ffmpeg-devel mailing list