[FFmpeg-cvslog] avutil/pixdesc: ensure the component being read or writen to is valid

James Almer git at videolan.org
Mon Oct 21 16:01:03 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct 17 22:29:31 2024 -0300| [72f8f76d45d0db36918ff7104c11fb9bfd8679d5] | committer: James Almer

avutil/pixdesc: ensure the component being read or writen to is valid

If depth is 0, then the component is invalid/unset.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72f8f76d45d0db36918ff7104c11fb9bfd8679d5
---

 libavutil/pixdesc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index d73c3f0d58..4d61e32a1e 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -45,6 +45,9 @@ void av_read_image_line2(void *dst,
     uint16_t *dst16 = dst;
     uint32_t *dst32 = dst;
 
+    if (!depth)
+        return;
+
     if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
         if (depth == 10) {
             // Assume all channels are packed into a 32bit value
@@ -124,6 +127,9 @@ void av_write_image_line2(const void *src,
     const uint32_t *src32 = src;
     const uint16_t *src16 = src;
 
+    if (!depth)
+        return;
+
     if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
         if (depth == 10) {
             // Assume all channels are packed into a 32bit value



More information about the ffmpeg-cvslog mailing list