Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca555f1e authored by Greg Kaiser's avatar Greg Kaiser
Browse files

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
parent abbe1a79
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -148,8 +148,8 @@ void Codec::encodeFrames(const uint8_t *data, size_t size) {
    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;