Fix potential index out of bounds

This commit is contained in:
Johan Mattsson 2023-10-30 01:12:26 +01:00 committed by GitHub
parent 5b3a57ca89
commit c2265ecbb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,7 +330,7 @@ circus_handle_t* circus_init(off_t start, uint8_t codec, uint8_t flags) {
handle->flags = flags; //(config >> 8) & 0xFF; handle->flags = flags; //(config >> 8) & 0xFF;
scale_index = (handle->flags & 0xF); scale_index = (handle->flags & 0xF);
if (scale_index > 5) goto fail; if (scale_index >= 5) goto fail;
handle->scales = scale_table[scale_index]; handle->scales = scale_table[scale_index];
if (handle->codec == XPCM_CODEC_VQ_DEFLATE) { if (handle->codec == XPCM_CODEC_VQ_DEFLATE) {