diff --git a/libavcodec/fits.c b/libavcodec/fits.c index 365347fc64..ad73ab70de 100644 --- a/libavcodec/fits.c +++ b/libavcodec/fits.c @@ -138,6 +138,17 @@ int avpriv_fits_header_parse_line(void *avcl, FITSHeader *header, const uint8_t case STATE_BITPIX: CHECK_KEYWORD("BITPIX"); CHECK_VALUE("BITPIX", bitpix); + + switch(header->bitpix) { + case 8: + case 16: + case 32: case -32: + case 64: case -64: break; + default: + av_log(avcl, AV_LOG_ERROR, "invalid value of BITPIX %d\n", header->bitpix); \ + return AVERROR_INVALIDDATA; + } + dict_set_if_not_null(metadata, keyword, value); header->state = STATE_NAXIS;