mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/fits: Check bitpix
Reference: Table 8: Interpretation of valid BITPIX value from FITS standard 4.0
Fixes: runtime error: division by zero
Fixes: 14581/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5652382425284608
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0b5c93b276
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
0060dc62f1
commit
8c9e131d3a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user