Bug 1110488 - Check for empty log before using it. r=jmuizelaar
authorMilan Sreckovic <milan@mozilla.com>
Tue, 06 Jan 2015 12:02:22 -0500
changeset 248113 bb194bedf519024d7969c3f8b4f1b33e41889129
parent 248112 95fe92605dd426362c3b22a8f0153dfca05e2f00
child 248114 d32672ecbff9a45e12bf74518bf0a0b32d92d222
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar
bugs1110488
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1110488 - Check for empty log before using it. r=jmuizelaar
dom/canvas/WebGLContextGL.cpp
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -3370,19 +3370,21 @@ WebGLContext::CompileShader(WebGLShader*
 
         if (!lenWithNull) {
             // Error in ShGetInfo.
             shader->SetTranslationFailure(NS_LITERAL_CSTRING("Internal error: failed to get shader info log"));
         } else {
             size_t len = lenWithNull - 1;
 
             nsAutoCString info;
-            info.SetLength(len); // Allocates len+1, for the null-term.
-            ShGetInfoLog(compiler, info.BeginWriting());
-
+            if (len) {
+                // Don't allocate or try to write to zero length string
+                info.SetLength(len); // Allocates len+1, for the null-term.
+                ShGetInfoLog(compiler, info.BeginWriting());
+            }
             shader->SetTranslationFailure(info);
         }
         ShDestruct(compiler);
         shader->SetCompileStatus(false);
         return;
     }
 
     size_t num_attributes = 0;