Bug 1391556 - fix incorrect out of bound check. r=jwwang
authorJohn Lin <jolin@mozilla.com>
Tue, 22 Aug 2017 10:06:41 +0800
changeset 376057 a402ebd682d2d6a44538d272c1f81488eaf5aae5
parent 376056 21cb52d98f1ce76926802fe853776eec551556f8
child 376058 4cb2de15167b3b7a42bc147f296df93000681199
push id49295
push userjolin@mozilla.com
push dateTue, 22 Aug 2017 04:47:05 +0000
treeherderautoland@a402ebd682d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1391556
milestone57.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 1391556 - fix incorrect out of bound check. r=jwwang MozReview-Commit-ID: JytNgl6bqCX
media/libstagefright/system/core/liblog/fake_log_device.c
--- a/media/libstagefright/system/core/liblog/fake_log_device.c
+++ b/media/libstagefright/system/core/liblog/fake_log_device.c
@@ -146,17 +146,17 @@ static LogState *openLogTable[MAX_OPEN_L
 /*
  * Allocate an fd and associate a new LogState with it.
  * The fd is available via the fakeFd field of the return value.
  */
 static LogState *createLogState()
 {
     size_t i;
 
-    for (i = 0; i < sizeof(openLogTable); i++) {
+    for (i = 0; i < MAX_OPEN_LOGS; i++) {
         if (openLogTable[i] == NULL) {
             openLogTable[i] = calloc(1, sizeof(LogState));
             openLogTable[i]->fakeFd = FAKE_FD_BASE + i;
             return openLogTable[i];
         }
     }
     return NULL;
 }