[opus] Opus 1.2.1 crash on silk/VAD.c:315

Jean-Marc Valin jmvalin at jmvalin.ca
Thu Sep 27 02:43:17 UTC 2018


Hi Dmitry,

So it's not explicitly in your report, but it looks like the crash is
due to a divide-by-zero at:
   min_coef = silk_DIV32_16( silk_int16_MAX, silk_RSHIFT(
              psSilk_VAD->counter, 4 ) + 1 );

which happens because counter is -16 (which means (-16 >> 4) + 1 == 0).
Now, this could be caused by an integer wrap-around, but it should only
happen after encoding around 2 years and 9 months of audio (1 year and 4
months for 10-ms frames). If that's really what you were doing, then it
should just be a matter of not incrementing the counter forever. OTOH,
if this is happening on a short clip, then it means some other
corruption is going on. Can you confirm which it is?

Cheers,

	Jean-Marc



On 09/21/2018 08:36 AM, Малинин Дмитрий wrote:
> Stack:
> (gdb) bt
> #0  0x0000000000aaf38a in silk_VAD_GetNoiseLevels
> (pX=pX at entry=0x7f26740297a0,
>     psSilk_VAD=psSilk_VAD at entry=0x15897c38) at silk/VAD.c:315
> #1  0x0000000000aa4a9d in silk_VAD_GetSA_Q8_sse4_1 (psEncC=0x15897c18,
> pIn=<optimized out>) at silk/x86/VAD_sse.c:177
> #2  0x0000000000a9f92b in silk_encode_do_VAD_FLP
> (psEnc=psEnc at entry=0x15897c18) at silk/float/encode_frame_FLP.c:51
> #3  0x0000000000a9a40c in silk_Encode
> (encState=encState at entry=0x15897c18, encControl=encControl at entry=0x158935a8,
>     samplesIn=0x7f267402a8a8, samplesIn at entry=0x7f267402a128,
> nSamplesIn=0, nSamplesIn at entry=960,
>     psRangeEnc=psRangeEnc at entry=0x7f267402bbe0,
> nBytesOut=nBytesOut at entry=0x7f267402bb9c, prefillFlag=0)
>     at silk/enc_API.c:443
> #4  0x0000000000a8366d in opus_encode_native (st=st at entry=0x158935a0,
> pcm=0x7f267402bf38, frame_size=960,
>     data=0x7f26b5a1084d "", data at entry=0x7f26b5a1084c "",
> out_data_bytes=1946331320, out_data_bytes at entry=5988,
>     lsb_depth=1065353216, lsb_depth at entry=16,
> analysis_pcm=analysis_pcm at entry=0x7f26b5a1084c,
>     analysis_size=analysis_size at entry=960, c1=c1 at entry=0,
> c2=c2 at entry=-2, analysis_channels=1,
>     downmix=downmix at entry=0xa80fe0 <downmix_int>,
> float_api=float_api at entry=0) at src/opus_encoder.c:1826
> #5  0x0000000000a85211 in opus_encode (st=0x158935a0,
> pcm=0x7f26b5a1084c, analysis_frame_size=960,
>     data=0x7f26b5a1084c "", max_data_bytes=5988) at src/opus_encoder.c:2227
> #6  0x00000000004ce892 in opus_encoder::transcode (this=0x21a30200,
> in_packet=0x7f267402cf30)
>     at
> /root/mediagateway/source/engine/media-objects/transcoder/codecs/opus.h:91
> 
> (gdb) frame 0
> #0  0x0000000000aaf38a in silk_VAD_GetNoiseLevels
> (pX=pX at entry=0x7f26740297a0,
>     psSilk_VAD=psSilk_VAD at entry=0x15897c38) at silk/VAD.c:315
> 315        min_coef = silk_DIV32_16( silk_int16_MAX, silk_RSHIFT(
> psSilk_VAD->counter, 4 ) + 1 );
> 
> (gdb) p *psSilk_VAD
> $20 = {AnaState = {0, 0}, AnaState1 = {0, 0}, AnaState2 = {0, 0},
> XnrgSubfr = {0, 0, 0, 0}, NrgRatioSmth_Q8 = {
>     25600, 25600, 25600, 25600}, HPstate = 0, NL = {50, 25, 16, 12},
> inv_NL = {42949656, 85899327, 134217709,
>     178956950}, NoiseLevelBias = {50, 25, 16, 12}, counter = -16}
> 
> 
> OS: Linux debian-build 3.2.0-4-amd64 #1 SMP Debian 3.2.93-1 x86_64 GNU/Linux
> gcc (Debian 4.7.2-5) 4.7.2
> 
> Regards,
> -- 
> Dmitry Malinin
> ITooLabs
> 
> 
> 
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
> 


More information about the opus mailing list