[FFmpeg-trac] #8747(undetermined:new): libswscale 4.3 crash if output buffer is not 16 bytes aligned for yuv2rgb conversion

FFmpeg trac at avcodec.org
Fri Jun 19 21:55:23 EEST 2020


#8747: libswscale 4.3 crash if output buffer is not 16 bytes aligned for yuv2rgb
conversion
-------------------------------------+-------------------------------------
             Reporter:  melanconj    |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 With the 4.3 release, swscale now crashes if provided with an output
 buffer that is not 16 bytes aligned for yuv2rgb conversions. It used to
 work in previous releases.

 How to reproduce:
 {{{
 #include <stdint.h>
 #include "libswscale\swscale.h"

 void main()
 {
         uint8_t* src = malloc(640*480);
         uint8_t* dst = malloc(640*480*4);
         if (((int64_t)dst & ~0xF) == (int64_t)dst) {
                 dst += 8; // Ensure we are unaligned. Comment out to see
 it work
         }

         const uint8_t* srcSlice [3] = { src, src, src };
         int srcStride[3] = {640, 320, 320};
         int dstStride = 640 * 3;

         void *context = sws_getCachedContext(NULL, 640, 480,
 AV_PIX_FMT_YUV420P, 640, 480, AV_PIX_FMT_RGB24, SWS_POINT, NULL, NULL,
 NULL);
         sws_scale(context, srcSlice, srcStride, 0, 480, &dst, &dstStride);
 }
 }}}

 It seems to have been introduced by the SSSE3 codepath that was added in
 commit fc6a5883d6af8cae0e96af84dda0ad74b360a084.
 I also found ticket https://trac.ffmpeg.org/ticket/8532 that found the
 same issue as mine but with the input buffer, which was fixed.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8747>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list