Bug 867597 - IonMonkey: ARM hwcaps detection depends on uninitialised garbage on the stack. r=mjrosenb, a=bajaj
authorJulian Seward <jseward@acm.org>
Fri, 13 Dec 2013 12:40:24 +0100
changeset 167838 80b8cfdcde6190d1a45c70a3138afb9bf2e25780
parent 167837 f36745a543a40cdf577f7bf91203eac71e1a519f
child 167839 2fb364c9bfd10dc0b50cf069b22e9ff3397bd3a8
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosenb, bajaj
bugs867597
milestone27.0
Bug 867597 - IonMonkey: ARM hwcaps detection depends on uninitialised garbage on the stack. r=mjrosenb, a=bajaj
js/src/jit/arm/Architecture-arm.cpp
--- a/js/src/jit/arm/Architecture-arm.cpp
+++ b/js/src/jit/arm/Architecture-arm.cpp
@@ -66,17 +66,18 @@ uint32_t GetARMFlags()
     return flags;
 
 #elif defined(WTF_OS_ANDROID) || defined(MOZ_B2G)
     FILE *fp = fopen("/proc/cpuinfo", "r");
     if (!fp)
         return false;
 
     char buf[1024];
-    fread(buf, sizeof(char), sizeof(buf), fp);
+    memset(buf, 0, sizeof(buf));
+    fread(buf, sizeof(char), sizeof(buf)-1, fp);
     fclose(fp);
     if (strstr(buf, "vfp"))
         flags |= HWCAP_VFP;
 
     if (strstr(buf, "vfpv3"))
         flags |= HWCAP_VFPv3;
 
     if (strstr(buf, "vfpv3d16"))