[FFmpeg-trac] #622(swscale:new): swscale crash when convert PIX_FMT_YUV420P -> PIX_FMT_YUVJ420P

FFmpeg trac at avcodec.org
Tue Nov 8 12:24:25 CET 2011


#622: swscale crash when convert PIX_FMT_YUV420P -> PIX_FMT_YUVJ420P
---------------------------------------+---------------------------------
               Reporter:  kyh96403     |                  Owner:  michael
                   Type:  defect       |                 Status:  new
               Priority:  important    |              Component:  swscale
                Version:  unspecified  |               Keywords:  sescale
             Blocked By:               |               Blocking:
Reproduced by developer:  0            |  Analyzed by developer:  0
---------------------------------------+---------------------------------
 swscale is crash below code.

 #include <stdio.h>
 #include <libswscale/swscale.h>

 int main()
 {
         int ww = 624; // crash
         int hh = 352;
 //      int ww = 48; // crash
 //      int hh = 48;
 //      int ww = 64; // not crash
 //      int hh = 64;
         int SwsFlag = SWS_POINT | SWS_ACCURATE_RND;
         struct SwsContext *context = NULL;
         uint8_t *src_data[4], *dst_data[4];
         int src_pitch[4], dst_pitch[4];

         context = sws_getCachedContext(context, ww, hh, PIX_FMT_YUV420P,
 ww, hh, PIX_FMT_YUVJ420P, SwsFlag, NULL, NULL, NULL);
         src_data[0] = av_malloc(ww * hh);
         src_data[1] = av_malloc(ww * hh / 4);
         src_data[2] = av_malloc(ww * hh / 4);
         src_data[3] = NULL;
         dst_data[0] = av_malloc(ww * hh);
         dst_data[1] = av_malloc(ww * hh / 4);
         dst_data[2] = av_malloc(ww * hh / 4);
         dst_data[3] = NULL;
         src_pitch[0] = ww;
         src_pitch[1] = ww / 2;
         src_pitch[2] = ww / 2;
         src_pitch[3] = 0;
         dst_pitch[0] = ww;
         dst_pitch[1] = ww / 2;
         dst_pitch[2] = ww / 2;
         dst_pitch[3] = 0;

         sws_scale(context, src_data, src_pitch, 0, hh, dst_data,
 dst_pitch);

         return 0;
 }

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


More information about the FFmpeg-trac mailing list