This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 86d2fae59f10625730ac054323e1a2b238a2959d
Author:     Zhao Zhili <[email protected]>
AuthorDate: Sun Jan 25 22:07:44 2026 +0800
Commit:     Zhao Zhili <[email protected]>
CommitDate: Thu Feb 26 11:40:09 2026 +0800

    avcodec: use int instead of enum for AVOption fields
    
    AVOption with AV_OPT_TYPE_INT assumes the field is int (4 bytes),
    but enum size is implementation-defined and may be smaller.
    This can cause memory corruption when AVOption writes 4 bytes
    to a field that is only 1-2 bytes, potentially overwriting
    adjacent struct members.
    
    Signed-off-by: Zhao Zhili <[email protected]>
---
 libavcodec/amfenc.h           | 6 ++++--
 libavcodec/bsf/filter_units.c | 3 ++-
 libavcodec/hap.h              | 3 ++-
 libavcodec/huffyuvenc.c       | 3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 8f5eb5a9ef..ff5ce0ba76 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -115,8 +115,10 @@ typedef struct AMFEncoderContext {
 
     // AV1 - specific options
 
-    enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM                 align;
-    enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM                        aq_mode;
+    /* enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM, use int for AVOption */
+    int                 align;
+    /* enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM */
+    int                 aq_mode;
 
     // Preanalysis - specific options
 
diff --git a/libavcodec/bsf/filter_units.c b/libavcodec/bsf/filter_units.c
index 336331733f..696a1f37c4 100644
--- a/libavcodec/bsf/filter_units.c
+++ b/libavcodec/bsf/filter_units.c
@@ -35,7 +35,8 @@ typedef struct FilterUnitsContext {
 
     const char *pass_types;
     const char *remove_types;
-    enum AVDiscard discard;
+    /* enum AVDiscard, use int for AVOption */
+    int discard;
     int discard_flags;
 
     enum {
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index 1de6d45428..b07f8a4b19 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -62,7 +62,8 @@ typedef struct HapContext {
 
     GetByteContext gbc;
 
-    enum HapTextureFormat opt_tex_fmt; /* Texture type (encoder only) */
+    /* enum HapTextureFormat, use int for AVOption */
+    int opt_tex_fmt; /* Texture type (encoder only) */
     int opt_chunk_count; /* User-requested chunk count (encoder only) */
     int opt_compressor; /* User-requested compressor (encoder only) */
 
diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
index b213d4dc95..0f6b18f0f6 100644
--- a/libavcodec/huffyuvenc.c
+++ b/libavcodec/huffyuvenc.c
@@ -48,7 +48,8 @@ typedef struct HYuvEncContext {
     AVClass *class;
     AVCodecContext *avctx;
     PutBitContext pb;
-    Predictor predictor;
+    /* Predictor, use int for AVOption */
+    int predictor;
     int interlaced;
     int decorrelate;
     int bitstream_bpp;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to