| commit | b4d9e1b41301b11bf4e4d7c9cfef27850e518b0c | [log] [tgz] |
|---|---|---|
| author | Lajos Molnar <lajos@google.com> | Tue Jun 27 13:58:07 2017 -0700 |
| committer | Lajos Molnar <lajos@google.com> | Tue Jun 27 13:59:30 2017 -0700 |
| tree | a45480c79e657207003812407b577fd490a7507d | |
| parent | cf39f0e67ab16d96b9b862641194e226d35afb79 [diff] |
stagefright: avoid buffer overflow in base64 decoder Bug: 62673128 Change-Id: Id5f04b772aaca3184879bd5bca453ad9e82c7f94
diff --git a/media/libstagefright/foundation/base64.cpp b/media/libstagefright/foundation/base64.cpp index 9581986..31fae4e 100644 --- a/media/libstagefright/foundation/base64.cpp +++ b/media/libstagefright/foundation/base64.cpp
@@ -74,8 +74,7 @@ accum = (accum << 6) | value; if (((i + 1) % 4) == 0) { - out[j++] = (accum >> 16); - + if (j < outLen) { out[j++] = (accum >> 16); } if (j < outLen) { out[j++] = (accum >> 8) & 0xff; } if (j < outLen) { out[j++] = accum & 0xff; }