[automerger] httplive: detect oom if playlist is infinite am: f3808d3a2e am: a7a8c35d92 am: f5dcf4dca9 am: 2f3fb2626c am: 188e94625d
Change-Id: Ibfa7dfde9c015b0b019e5307585ae9807d22c7f4
diff --git a/media/libstagefright/httplive/HTTPDownloader.cpp b/media/libstagefright/httplive/HTTPDownloader.cpp
index 793695a..9d40d3e 100644
--- a/media/libstagefright/httplive/HTTPDownloader.cpp
+++ b/media/libstagefright/httplive/HTTPDownloader.cpp
@@ -157,6 +157,12 @@
buffer->size() + bufferRemaining);
sp<ABuffer> copy = new ABuffer(buffer->size() + bufferRemaining);
+ if (copy->data() == NULL) {
+ android_errorWriteLog(0x534e4554, "68399439");
+ ALOGE("not enough memory to download: requesting %zu + %zu",
+ buffer->size(), bufferRemaining);
+ return NO_MEMORY;
+ }
memcpy(copy->data(), buffer->data(), buffer->size());
copy->setRange(0, buffer->size());