Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions silk/test/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ int main( int argc, char* argv[] )
break;
}

if( nBytes > MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES ) {
fprintf( stderr, "\rPacket is too large: %d", nBytes );
return -1;
}

/* Read payload */
counter = fread( payloadEnd, sizeof( SKP_uint8 ), nBytes, bitInFile );
if( ( SKP_int16 )counter < nBytes ) {
Expand Down Expand Up @@ -459,14 +464,6 @@ int main( int argc, char* argv[] )
for( i = 0; i < MAX_LBRR_DELAY; i++ ) {
totBytes += nBytesPerPacket[ i + 1 ];
}

/* Check if the received totBytes is valid */
if (totBytes < 0 || totBytes > sizeof(payload))
{

fprintf( stderr, "\rPackets decoded: %d", totPackets );
return -1;
}

SKP_memmove( payload, &payload[ nBytesPerPacket[ 0 ] ], totBytes * sizeof( SKP_uint8 ) );
payloadEnd -= nBytesPerPacket[ 0 ];
Expand Down