diff options
Diffstat (limited to 'indra/llimage/llimagetga.cpp')
-rw-r--r-- | indra/llimage/llimagetga.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index 1007f8e2bb..f19d85d754 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -183,7 +183,7 @@ BOOL LLImageTGA::updateData() // discard the ID field, if any if (mIDLength) { - memcpy(junk, getData()+mDataOffset, mIDLength); + memcpy(junk, getData()+mDataOffset, mIDLength); /* Flawfinder: ignore */ mDataOffset += mIDLength; } @@ -220,7 +220,12 @@ BOOL LLImageTGA::updateData() if ( (1 == mImageType) || (9 == mImageType) ) { mColorMap = new U8[ color_map_bytes ]; - memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); + if (!mColorMap) + { + llerrs << "Out of Memory in BOOL LLImageTGA::updateData()" << llendl; + return FALSE; + } + memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */ } mDataOffset += color_map_bytes; @@ -432,7 +437,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu } else if (getComponents() == 1) { - memcpy(dst, src, pixels); + memcpy(dst, src, pixels); /* Flawfinder: ignore */ } return TRUE; @@ -673,7 +678,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) switch( getComponents() ) { case 1: - memcpy( dst, src, bytes_per_pixel * pixels ); + memcpy( dst, src, bytes_per_pixel * pixels ); /* Flawfinder: ignore */ break; case 2: @@ -1053,7 +1058,7 @@ bool LLImageTGA::loadFile( const LLString& path ) return false; } - FILE *file = LLFile::fopen(path.c_str(), "rb"); + FILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */ if( !file ) { llwarns << "Couldn't open file " << path << llendl; |