#6763: swscale: Out-of-bounds memory accesses
------------------------------------+-----------------------------------
             Reporter:  Gramner     |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  important   |                Component:  swscale
              Version:  git-master  |               Resolution:
             Keywords:  crash       |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Comment (by hackerfactor):

 I just ran into this same problem.

 `sws_scale(swsctx, FrameIn->data,FrameIn->linesize, 0, FrameIn->height,
 FrameOut->data, FrameOut->linesize);`

 I included some debugging print lines:
 ```
 Frame In: 540x360  linesize=640
 Frame Out: 540x360  linesize=1620
 ```

 The video is mp4, YUV444 and being converted to RGB24. It reports to
 stderr:
 `[swscaler @ 0x16c7300] Warning: data is not aligned! This can lead to a
 speed loss`

 The output buffer is allocated as 540x360x3 = 583200 bytes.
 However, the misalignment causes sws_scale to write-overflow. (Valgrind
 detected it.) I see the same problem when using vlc and other video
 players on the same video since they use the same ffmpeg library.

 My workaround: Allocate enough space to round up to a width that is
 divisible by 8. (Allocate 544x360x3 = 587520 bytes.)
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/6763#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to