mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-03-13 09:00:40 +08:00
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 <zhilizhao@tencent.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user