From 949e2694023f7ee14c63f377a8707c5d06e91b3c Mon Sep 17 00:00:00 2001 From: phr0z3nt04st Date: Sun, 16 May 2010 22:05:10 -0500 Subject: [PATCH] Added zmagic to decoding of ogg files instead of snowglobes audio crash fix, allows old sounds longer then 30 secs to play. --- indra/llaudio/llaudiodecodemgr.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 0b9088142..6427addc9 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -226,24 +226,21 @@ BOOL LLVorbisDecodeState::initDecode() size_guess += 2048; bool abort_decode = false; - - if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS ) + + // This magic value is equivilent to 150MiB of data. + // Prevents griffers from utilizin a huge xbox sound the size of god to instafry the viewer + if(size_guess >= 157286400) + { + llwarns << "Bad sound caught by zmagic" << llendl; + abort_decode = true; + } + + else if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS ) { abort_decode = true; llwarns << "Bad channel count: " << vi->channels << llendl; } - - if( (size_t)sample_count > LLVORBIS_CLIP_REJECT_SAMPLES ) - { - abort_decode = true; - llwarns << "Illegal sample count: " << sample_count << llendl; - } - - if( size_guess > LLVORBIS_CLIP_REJECT_SIZE ) - { - abort_decode = true; - llwarns << "Illegal sample size: " << size_guess << llendl; - } + if( abort_decode ) {