Bug 1840399 - Fix static-analysis warnings in OpusParser. r=media-playback-reviewers,alwu DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D182068
This commit is contained in:
Paul Adenot 2023-08-01 12:41:13 +00:00
Родитель 4e1b0f6a67
Коммит 05930dc13a
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -39,7 +39,7 @@ OpusParser::OpusParser()
}
bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) {
if (aLength < 19 || memcmp(aData, "OpusHead", 8)) {
if (aLength < 19 || memcmp(aData, "OpusHead", 8) != 0) {
OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: unrecognized header"));
return false;
}
@ -143,7 +143,9 @@ bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) {
}
bool OpusParser::DecodeTags(unsigned char* aData, size_t aLength) {
if (aLength < 16 || memcmp(aData, "OpusTags", 8)) return false;
if (aLength < 16 || memcmp(aData, "OpusTags", 8) != 0) {
return false;
}
// Copy out the raw comment lines, but only do basic validation
// checks against the string packing: too little data, too many

Просмотреть файл

@ -32,7 +32,7 @@ class OpusParser {
int mChannelMapping; // Channel mapping family.
int mStreams; // Number of packed streams in each packet.
int mCoupledStreams; // Number of packed coupled streams in each packet.
unsigned char mMappingTable[255]; // Channel mapping table.
unsigned char mMappingTable[255] = {}; // Channel mapping table.
// Granule position (end sample) of the last decoded Opus packet. This is
// used to calculate the amount we should trim from the last packet.