• Show log

    Commit

  • Hash : d2608583
    Author : DRC
    Date : 2023-01-05T10:51:12

    TurboJPEG: Ensure 'pad' arg is a power of 2
    
    Because the PAD() macro can only handle powers of 2, this is a necessary
    restriction (and a documented one, except in the case of
    tjCompressFromYUV()-- oops.)  Failing to check the 'pad' argument
    caused tjBufSizeYUV2() to return bogus results if 'pad' was less than 1
    or otherwise not a power of 2.  tjEncodeYUV3() and tjDecodeYUV()
    effectively treated a 'pad' value of 0 as unpadded, but that was subtle
    and undocumented behavior.  tjCompressFromYUV() did not check whether
    'pad' was a power of 2, so the strides passed to
    tjCompressFromYUVPlanes() would have been incorrect if 'pad' was not a
    power of 2.  That would not have caused tjCompressFromYUV() to overrun
    the source buffer, as long as the calling application allocated the
    buffer based on the return value of tjBufSizeYUV2() (which computes the
    strides in the same manner as tjCompressFromYUV().)  However, if the
    calling application attempted to initialize the source buffer using
    correctly-computed strides, then it could have overrun its own
    buffer in certain cases or produced incorrect JPEG images in others.
    
    Realistically, there is no reason why an application would want to pass
    a non-power-of-2 'pad' value to a TurboJPEG API function, so this commit
    is about user-proofing the API rather than fixing any known issue.
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/libjpeg-turbo.git
    Git SSH git@git.kmx.io:kc3-lang/libjpeg-turbo.git
    Public access ? public
    Description

    Fork of libjpeg with SIMD

    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg_l thodg
    Tags