• Will Storey's avatar
    image/gif: handle an extra data sub-block byte. · 4775b7fe
    Will Storey authored
    This changes the decoder's behaviour when there is stray/extra data
    found after an image is decompressed (e.g., data sub-blocks after an LZW
    End of Information Code). Instead of raising an error, we silently skip
    over such data until we find the end of the image data marked by a Block
    Terminator. We skip at most one byte as sample problem GIFs exhibit this
    property.
    
    GIFs should not have and do not need such stray data (though the
    specification is arguably ambiguous). However GIFs with such properties
    have been seen in the wild.
    
    Fixes #16146
    
    Change-Id: Ie7e69052bab5256b4834992304e6ca58e93c1879
    Reviewed-on: https://go-review.googlesource.com/37258Reviewed-by: default avatarNigel Tao <nigeltao@golang.org>
    Run-TryBot: Nigel Tao <nigeltao@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    4775b7fe
reader.go 15.4 KB