[FFmpeg-devel] [PATCH] libavutil/opt: fix av_opt_set_channel_layout() to access correct memory address

Philip DeCamp decamp at mit.edu
Wed Sep 24 22:15:18 CEST 2014


Signed-off-by: Philip DeCamp <decamp at mit.edu>
---
 libavutil/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index ca4edb8..ee72a96 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -627,8 +627,7 @@ int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int searc
                "The value set by option '%s' is not a channel layout.\n", o->name);
         return AVERROR(EINVAL);
     }
-    *(int *)(((int64_t *)target_obj) + o->offset) = cl;
+    *(int64_t *)(((uint8_t *)target_obj) + o->offset) = cl;
     return 0;
 }
 
-- 
Calling "av_opt_set_channel_layout()" was writing to the wrong address. It was casting the target object to an int64* instead of an int8* before adding the field offset.



More information about the ffmpeg-devel mailing list