Massive commit, beefed up the audio crash prevention, made a blacklist for assets, added sound explorer, fixed import, added item button to vfs explorer.

JELLY ROLL
This commit is contained in:
phr0z3nt04st
2010-07-08 00:20:37 -05:00
parent 30f5ce7491
commit 82aef8fa4c
27 changed files with 1232 additions and 61 deletions

View File

@@ -226,7 +226,7 @@ BOOL LLVorbisDecodeState::initDecode()
size_guess += 2048;
bool abort_decode = false;
// <edit>
// 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)
@@ -235,7 +235,7 @@ BOOL LLVorbisDecodeState::initDecode()
abort_decode = true;
}
else if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS )
else /* </edit> */if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS )
{
abort_decode = true;
llwarns << "Bad channel count: " << vi->channels << llendl;
@@ -251,8 +251,25 @@ BOOL LLVorbisDecodeState::initDecode()
return FALSE;
}
mWAVBuffer.reserve(size_guess);
mWAVBuffer.resize(WAV_HEADER_SIZE);
// <edit>
try
{
// </edit>
mWAVBuffer.reserve(size_guess);
mWAVBuffer.resize(WAV_HEADER_SIZE);
// <edit>
}
catch(std::bad_alloc)
{
llwarns << "bad_alloc" << llendl;
if(mInFilep)
{
delete mInFilep;
mInFilep = NULL;
}
return FALSE;
}
// </edit>
{
// write the .wav format header
@@ -425,7 +442,10 @@ BOOL LLVorbisDecodeState::finishDecode()
char pcmout[4096]; /*Flawfinder: ignore*/
fade_length = llmin((S32)128,(S32)(data_length-36)/8);
if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
// <edit>
//if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
if((S32)mWAVBuffer.size() > (WAV_HEADER_SIZE + 2* fade_length))
// </edit>
{
memcpy(pcmout, &mWAVBuffer[WAV_HEADER_SIZE], (2 * fade_length)); /*Flawfinder: ignore*/
}
@@ -444,7 +464,10 @@ BOOL LLVorbisDecodeState::finishDecode()
memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/
}
S32 near_end = mWAVBuffer.size() - (2 * fade_length);
if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
// <edit>
//if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
if ((S32)mWAVBuffer.size() > ( near_end + 2* fade_length))
// </edit>
{
memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/
}
@@ -543,13 +566,18 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
{
if (mCurrentDecodep)
{
BOOL res;
// <edit> rawrning
//BOOL res;
BOOL res = false;
// </edit>
// Decode in a loop until we're done or have run out of time.
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
{
// decodeSection does all of the work above
}
/* <edit> */ try{ /* </edit> */
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
{
// decodeSection does all of the work above
}
/* <edit> */ }catch(std::bad_alloc){llerrs<<"bad_alloc whilst decoding"<<llendl;} /* </edit> */
if (mCurrentDecodep->isDone() && !mCurrentDecodep->isValid())
{