mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-13 10:30:05 +01:00
avcodec/g723_1enc: Make min_err 64bit
This is intending to fix the case described in https://lists.ffmpeg.org/archives/list/ffmpeg-devel@ffmpeg.org/thread/AAZ7GJPPUJI5SCVTDGJ6QL7UUEP56WOM/
Where FCBParam optim is used uninitialized
a min_err of 1<<30, allows the struct to be never initilialized as all
err (which is int32_t) can be larger than min_err. By increasing min_err
above the int32_t range this is no longer possible
Untested, as i do not have the testcase
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>i
(cherry picked from commit 909af3a571)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -108,7 +108,7 @@ typedef struct HFParam {
|
|||||||
* Optimized fixed codebook excitation parameters
|
* Optimized fixed codebook excitation parameters
|
||||||
*/
|
*/
|
||||||
typedef struct FCBParam {
|
typedef struct FCBParam {
|
||||||
int min_err;
|
int64_t min_err;
|
||||||
int amp_index;
|
int amp_index;
|
||||||
int grid_index;
|
int grid_index;
|
||||||
int dirac_train;
|
int dirac_train;
|
||||||
|
|||||||
@@ -1019,7 +1019,7 @@ static void fcb_search(G723_1_ChannelContext *p, int16_t *impulse_resp,
|
|||||||
int pulse_cnt = pulses[index];
|
int pulse_cnt = pulses[index];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
optim.min_err = 1 << 30;
|
optim.min_err = 1LL << 31;
|
||||||
get_fcb_param(&optim, impulse_resp, buf, pulse_cnt, SUBFRAME_LEN);
|
get_fcb_param(&optim, impulse_resp, buf, pulse_cnt, SUBFRAME_LEN);
|
||||||
|
|
||||||
if (p->pitch_lag[index >> 1] < SUBFRAME_LEN - 2) {
|
if (p->pitch_lag[index >> 1] < SUBFRAME_LEN - 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user