mpeg4_enc_fuzzer: Fix sizeof() bugs
When we changed inputBuffer from a stack array to a pointer, it
changed what sizeof(inputBuffer) means (from the entire size of
the array, to just the size of a pointer).
Since we intended to know the entire size of the array, we
replace the sizeof() usages accordingly.
Test: TreeHugger
Change-Id: I0a9515a9e0fe63e258056bfdbf19310560e02504
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp
index 4033c6c..423325d 100644
--- a/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp
@@ -148,8 +148,8 @@
while (size > 0) {
size_t bytesConsumed = std::min(size, inputBufferSize);
memcpy(inputBuffer, data, bytesConsumed);
- if (bytesConsumed < sizeof(inputBuffer)) {
- memset(inputBuffer + bytesConsumed, data[0], sizeof(inputBuffer) - bytesConsumed);
+ if (bytesConsumed < inputBufferSize) {
+ memset(inputBuffer + bytesConsumed, data[0], inputBufferSize - bytesConsumed);
}
VideoEncFrameIO videoIn{}, videoOut{};
videoIn.height = mFrameHeight;