diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-09-08 00:31:41 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-11-25 18:19:59 +0100 |
commit | 252746d052652b48f7bc0652e7c1601b1e997d9c (patch) | |
tree | 2c8b3a0dc17251eb033918222dd9232bb14e2f3c /libavutil/imgutils.c | |
parent | 26c531cc223d5ac6e5fd78f2364247a3d902b946 (diff) | |
download | ffmpeg-streaming-252746d052652b48f7bc0652e7c1601b1e997d9c.zip ffmpeg-streaming-252746d052652b48f7bc0652e7c1601b1e997d9c.tar.gz |
lavu/imgutils: add consistency checks to av_image_copy_plane()
Add assertions and abort in case of invalid |dst_linesize| < bytewidth or
|src_linesize| < bytewidth.
Avoid to silently corrupt memory.
Diffstat (limited to 'libavutil/imgutils.c')
-rw-r--r-- | libavutil/imgutils.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 8595ba1..3060b07 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -21,6 +21,7 @@ * misc image utilities */ +#include "avassert.h" #include "common.h" #include "imgutils.h" #include "internal.h" @@ -244,6 +245,8 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, { if (!dst || !src) return; + av_assert0(abs(src_linesize) >= bytewidth); + av_assert0(abs(dst_linesize) >= bytewidth); for (;height > 0; height--) { memcpy(dst, src, bytewidth); dst += dst_linesize; |