Skip to content
  • Robert Ancell's avatar
    Fix the check for maximum value of LZW initial code size. · 19ebba03
    Robert Ancell authored
    This value is the number of bits for each symbol (i.e. colour index) decoded via LZW.
    The maximum LZW code is specified as 12 bits, so the value here can only be 11 as two additional code words are required (clear and end of information) that immediately uses an additional bit.
    This implementation has always been wrong, and the Firefox implementation has the same issue so it seems a common misinterpretation of the spec.
    This has been changed here to avoid an assertion later in the LZW decoder.
    Note that there is never any reason for a GIF to be encoded with more than 8 bits of colour information, as the colour tables only support up to 8 bits.
    19ebba03