Opened 3 years ago

Closed 3 years ago

Last modified 20 months ago

#9368 closed defect (fixed)

Valid webp file fails to decode (color indexing + predictor transform)

Reported by: marylauc Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: webp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Webp images with 16 or fewer colors, that use a "color indexing" transform followed by a predictor transform fail to decode.

With the attached example, the error produced is "Transform 3 used more than once"
However, there are only two transforms. First a color indexing transform (type 3) then a predictor transform (type 0).
Ffmpeg reads the data for the second transform incorrectly, which throws off the rest of the parsing.

How to reproduce:

% ffmpeg -i cut_x_lef.webp cut_x_lef.png
ffmpeg version N-103193-gc60b76d0c8 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6+build2)
  configuration: 
  libavutil      57.  3.100 / 57.  3.100
  libavcodec     59.  4.101 / 59.  4.101
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  1.103 /  8.  1.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
[webp @ 0x56107f3c0e80] Transform 3 used more than once

In images with 16 or fewer colors, a color indexing transform triggers "pixel bundling", which "packs several (2, 4, or 8) pixels into a single pixel, reducing the image width respectively."

This reduced width should be used for reading data for subsequent transforms.

I believe that in webp.c, parse_transform_predictor should use s->reduced_width instead of s->width if non zero. The same might be true for parse_transform_color and decode_entropy_image as well.

Attachments (1)

cut_x_lef.webp (194 bytes ) - added by marylauc 3 years ago.
valid webp file failing to decode

Download all attachments as: .zip

Change History (3)

by marylauc, 3 years ago

Attachment: cut_x_lef.webp added

valid webp file failing to decode

comment:1 by jzern, 3 years ago

Resolution: fixed
Status: newclosed

This was fixed with:

9f4708c22def8a0f13c3b2bc39baca928bb58aaa webp: fix transforms after a palette with pixel packing.

The addition of a sample for fate is still pending.

Last edited 20 months ago by Carl Eugen Hoyos (previous) (diff)

comment:2 by Carl Eugen Hoyos, 20 months ago

Component: undeterminedavcodec
Keywords: webp added
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.