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

Commit 980f66ea authored by Ray Essick's avatar Ray Essick
Browse files

Guard against negative sizes from codec

Protect against a negative codec buffer sizes. Avoids casting a negative
size to a very large size.

Bug: 193904641
Test: soundpool invocations during boot
Change-Id: If0e71537ca6301344df1f2f1493ed6b81bbed1f3
parent 9e227736
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ static status_t decode(int fd, int64_t offset, int64_t length,
                                __func__);
                        break;
                    }
                    const size_t dataSize = std::min((size_t)info.size, available);
                    const size_t dataSize = std::min(available, (size_t)std::max(info.size, 0));
                    memcpy(writePos, buf + info.offset, dataSize);
                    writePos += dataSize;
                    written += dataSize;