diff options
| author | Rye <rye@alchemyviewer.org> | 2025-08-20 18:04:55 -0400 |
|---|---|---|
| committer | Rye <rye@alchemyviewer.org> | 2025-08-20 18:04:55 -0400 |
| commit | ba30737d8f4add8ddd8c77d18df6497b46583fe9 (patch) | |
| tree | 81e5412a364ff80b5250fe6db9e653d35621c20e /indra/llrender/llimagegl.cpp | |
| parent | f0db568bf8d313a00e10c1c4ee4dd7f716a9d987 (diff) | |
| parent | d5f748c91c650a2ec534c497b9e098ccb317d70b (diff) | |
Merge branch 'develop' of github.com:secondlife/viewer into rye/infinitemac
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
| -rw-r--r-- | indra/llrender/llimagegl.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3f8903ca09..1db36d91f9 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1870,8 +1870,17 @@ bool LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, (GLint*)&glbytes); if(!imageraw->allocateDataSize(width, height, ncomponents, glbytes)) { - LL_WARNS() << "Memory allocation failed for reading back texture. Size is: " << glbytes << LL_ENDL ; - LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; + constexpr S64 MAX_GL_BYTES = 2048 * 2048; + if (glbytes > 0 && glbytes <= MAX_GL_BYTES) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Memory allocation failed for reading back texture. Data size: " << glbytes << LL_ENDL; + } + else + { + LL_WARNS() << "Memory allocation failed for reading back texture. Data size is: " << glbytes << LL_ENDL; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL; + } return false ; } @@ -1882,8 +1891,18 @@ bool LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre { if(!imageraw->allocateDataSize(width, height, ncomponents)) { - LL_WARNS() << "Memory allocation failed for reading back texture." << LL_ENDL ; - LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; + constexpr F32 MAX_IMAGE_SIZE = 2048 * 2048; + F32 size = (F32)width * (F32)height * (F32)ncomponents; + if (size > 0 && size <= MAX_IMAGE_SIZE) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Memory allocation failed for reading back texture. Data size: " << size << LL_ENDL; + } + else + { + LL_WARNS() << "Memory allocation failed for reading back texture." << LL_ENDL; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL; + } return false ; } |
