[FFmpeg-devel] [WIP] False positives on Coverity

Michael Niedermayer michael at niedermayer.cc
Tue May 14 02:38:16 EEST 2024


Hi all

To keep people updated (and as this is not vissible on the ML)
heres my current list of issues marked as false positives / intentional in Mai & April 2024
(in case anyone wants to review, i presume noone wants but just in case)

1409917 Unintentional integer overflow   No overflow happens as dimensions and sprite accuracy are too limited
1409920 Unintentional integer overflow   The involved variables are too restricted for overflow
1416963 Unintentional integer overflow   No overflow happens as bytes of an image are addressible by int
1417663 Uninitialized scalar variable    par_m_source is 0..3 and mid is initialized
1419522 Unintentional integer overflow   No overflow can happen, the values are too restricted
1419833 Untrusted loop bound             The loop bound is limited to 65535
        I also submit a patch to check the 2nd case better
1500345 Uninitialized scalar variable    Not a bugf strictly but bad practice and fix submitted
1503083 Uninitialized pointer read   nb_channels is non negative, coverity assumes it could be negative
1452594 Free of array-typed value    passed flags are 0 but assumed by coverity to be non 0
1452451 Use after free               coverity assumes FLAGS has values it does not
1452474 Use after free               coverity assumes FLAGS has values it does not
1452532 Use after free               coverity assumes FLAGS has values it does not
1524728 Free of array-typed value    coverity assumes 0 (flags) is not 0
1591440 Free of array-typed value    coverity assumes 0 (flags) is not 0
1452617 Free of array-typed value     coverity assumes AV_DICT_DONT_STRDUP_KEY but that is not set
1520670 Dereference after null check  either frame or pkt is NULL
1524701 Free of array-typed value     coverity assumes flags to be non 0 while it is 0
1538859 Dereference after null check  frame is always non-NULL for audio and video
1596536 Dereference null return value  There should be a descriptor for every type that is used
1518989 Missing break in switch      no break is intentional
1559177 Resource leak                av_fifo_write() either succeeds or the frame is freed
1559181 Resource leak                av_fifo_write() either succeeds or the frame is freed
1596530 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1516444 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1524729 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1596628 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1452412 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1452415 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1452551 Free of array-typed value    coverity assumes flags to be a value it is not
1559186 Resource leak                The value is stored by  av_fifo_write() and thus not lost
1452419 Free of array-typed value    coverity assumes flags to be non 0 while it is 0
1452457 Missing break in switch      this looks intentional
1500328 Resource leak                packet_queue_put_private() either stores pkt1 or it fails and its freed
1452606 Free of array-typed value    coverity assumes AV_DICT_DONT_STRDUP_VAL is set while it is not
1551681 Data race condition          The mutex is in the caller
1475938 Uninitialized array index read    all of dither seems to be intiialized
1465483 Unintentional integer overflow  the clip limits len
1473539 Explicit null dereferenced  new_rematrixing_strategy is always set for block 0
1596532 Copy of overlapping memory  num_blocks ia positive so the loop does at least one iteration
1500322 Out-of-bounds read  the mode is simply not possible
1473499 Uninitialized scalar variable  the default case seems unreachable
1595709 Uninitialized scalar variable  num_uv_points cannot be set when predict_uv_scaling is uninitialized
1595705 Uninitialized scalar variable  the parts of scaling used and initialized
1595706 Uninitialized scalar variable  the parts of scaling used and initialized
1595707 Unintended sign extension  the array is not gb sized, the shift is not nearly that large
1467648 Untrusted loop bound  loop bound is 16bit and thus bound by 65535, its also bound by the data length
1504415 Untrusted value as argument  av_grow_packet() will allocate a buffer matching the value or it will fail
1545117 Division or modulo by zero   coverity assumes the loop never executes but thats not currently possible
1473510 Untrusted loop bound   the read values are checked when they are read
1507875 Untrusted array index read  seq_parameter_set_id is checked when read (also coverity seems to have alot of problems with the multiple layers of macros and functions in the CBS system)
1452623 Free of address-of expression  coverity fails to keep track of data_ref/data_buf
1458177 Free of address-of expression  coverity assumes data_ref is NULL
1465491 Unintentional integer overflow  8 is smaller than 32
1465864 Out-of-bounds read   coverity assumes planes can be more than 4
1543204 Logically dead code  Lynne preferres to keep this code
1500292 Unintentional integer overflow  the error is too small for an overflow to happen
1443722 Unintentional integer overflow  image dimensions do not overflow 32bit
1467656 Out-of-bounds access  There is enough space allocated for what is accessed
1427586 Out-of-bounds read  coverity assumes (x&511) >= 512
1465486 Unintentional integer overflow  16bit + 8bit doesnt need 64bit
1496852 Macro compares unsigned to 0  macro tests the valid range, one side is 0
1596606 Unintentional integer overflow  valid width * height must fit in int
1452461 Free of array-typed value  coverity 0 != 0 flags issue
1473505 Untrusted loop bound  The loop is checking the upper bound
1466634 Missing break in switch  fallthrough initializes [0]
1516445 Out-of-bounds read  a  j=0; j<1; j++ loops does not execute twice
1473591 Untrusted loop bound  The loop checks if more data remains
1496615 Explicit null dereferenced  code is not reachable with frame = NULL
1532404 Untrusted loop bound  the loop tests if data is remaining
1452436 Free of array-typed value   0 is really 0
1485002 Unintentional integer overflow  dc_w and dc_h (xsize * ysize) is tested by av_image_check_size2()
1500327 Unintentional integer overflow  width *planes does not overflow
1452485 Free of array-typed value  flags 0 is really 0
1500307 Unintentional integer overflow  The arguments to the multiplication are small numbers
1500324 Unintentional integer overflow   The arguments to the multiplication are small numbers
1500335 Unintentional integer overflow   The arguments to the multiplication are small numbers
1500337 Unintentional integer overflow   The arguments to the multiplication are small numbers
1551680 Check of thread-shared field evades lock acquisition  thread1 and thread2 are the same and the main thread so they dont need a mutex between each other
1551686 Data race condition  task index is not changed by another thread
1551692 Data race condition    the return code is not changed once the task has returned a code
1452477 Untrusted value as argument  zsize is positve and its maximum is checked
1500326 Unintentional integer overflow  no overflow
1500323 Unintentional integer overflow  ccr_bur*cb_tbl cannot overflow here atm
1500348 Unintentional integer overflow  f*ff_g723_1_cos_tab will not overflow here atm
1500352 Unintentional integer overflow  16bit * 16384 will not overflow
1515882 Unintentional integer overflow
1515883 Unintentional integer overflow
1515884 Unintentional integer overflow
1473559 Uninitialized scalar variable  coverity hallucinates different sub_mb_type values each time it looks
1465261 Free of array-typed value  and 0 is still 0
1413314 Untrusted pointer read  The code seems ok, just ugly
1430928 Untrusted loop bound  The values are checked against size
1430929 Untrusted value as argument  The values are checked against side_data_size
1452417 Free of array-typed value  coverity still fails to consider the flag value
1452423 Free of array-typed value  0 is REALLY 0
1452553 Free of array-typed value  0 AV_DICT_DONT_OVERWRITE is not AV_DICT_DONT_STRDUP_VAL
1452575 Free of array-typed value  0 is REALLY 0
1466602 Free of array-typed value  if flags 0 is passed then the flags argument is 0
1473502 Untrusted loop bound  seeking to a "untrusted value" is fine
1473502 Untrusted loop bound  avio_seek() checks the offset
1473544 Untrusted loop bound  allocate then store
1473561 Untrusted pointer write   a non negative variable only needs a upper bound check, i will suggest to add a assert though. This code does have a feeling of fragility to it
1473589 Untrusted value as argument    mode_blocksize is 0 or 1
1477411 Free of array-typed value  another 0 is not 0 in coverity
1477412 Untrusted divisor  the pcrs are checked so they are not equal
1477435 Untrusted loop bound  inside the loop there are checks
1477437 Untrusted loop bound  the code just skips over the chunk size with avio_skip()
1500301 String not null terminated the   profile_string const and 0 terminated. p is initialized to all 0, there is remaining space after the memcpy thus p is 0 terminated
1500302 Uninitialized scalar variable   is_pipe and ts_from_file is contradicting
1452430 Free of array-typed value   0 != 0 again
1442565 Untrusted loop bound    dict_entries is checked against extradata_size
1596608 Dereference after null check  a new frame is allocated by ff_progress_frame_get_buffer
1455684 Unintentional integer overflow  w*h doesnt overflow w*h/256*100 also wont
1361959 Untrusted loop bound  cnt is checked against bytestream2_get_bytes_left(&dgb
1473503 Untrusted loop bound  the loop checks if there is input data remaining
1473551 Untrusted loop bound  the loop is checked by height and linesize
1473573 Untrusted loop bound  the loop checks if there is input data remaining
1473506 Missing break in switch  intentional
1466603 Uninitialized scalar variable   good_thresh is given inconsistant values by coverity
1528149 Unintended sign extension   width * height < 4096
1547074 Missing break in switch    intentional fallthrough
1547075 Missing break in switch   intentional fallthrough
1477413 Missing break in switch   intentional fallthrough
1512411 Dereference after null check  pkt_out is NULL for alpha, the dereference is under !ctx->is_alpha
1530136 Operands don't affect result  LONG may be the same as uint64_t but it doesnt have to be
1465488 Unintentional integer overflow    with 1U this is now a false positive
1500294 Unintentional integer overflow   the shift is limited to 7+15
1465264 Free of array-typed value  0 & x == 0
1521983 Unintentional integer overflow
1465484 Unintentional integer overflow  the dc chroma vlcs dont overflow 32bit
1465485 Unintentional integer overflow  the dc luma vlcs dont overflow 32bit
1473497 Uninitialized scalar variable  switch case default is impossible
1473517 Uninitialized scalar variable  switch case default is impossible
1500291 Unintentional integer overflow  Straight above the use its checked
1500295 Unintentional integer overflow   Straight above the use its checked
1465480 Unintentional integer overflow   mb num doesnt overflow
1465490 Unintentional integer overflow   ESC3 should not  overflow
1473567 Result is not floating-point   yes thats how the mp3 dequant works
1503079 Division or modulo by zero   coverity assumes frames = 0 but this is impossible
1465482 Unintentional integer overflow   the number of bits written is max 10 so no overflow is possible
1596736 Untrusted loop bound   the flags are 0, coverity assumes they are not and taking an impossible branch / The 2 of 3 case is unrelated, and simply checks strcasecmps the given filename
1596737 Free of array-typed value  the flags are 0, coverity assumes they are not and taking an impossible branch
1441937 Unintentional integer overflow  MB  num doesnt overflow
1500279 Unintentional integer overflow  libopus uses 16bit so 32 will suffice
1452479 Out-of-bounds access   coverity disregards thath the nlsf[] access is after a i != order check
1452618 Out-of-bounds access   coverity assumes impossible subframes, this begins with the assumtation of duration_ms=60 and nb_frames = 1, which is already not possible at the same time
1447467 Free of address-of expression  the flags are 0, coverity assumes they are not and taking an impossible branch
1521984 Free of array-typed value  the flags are 0, coverity assumes they are not and taking an impossible branch
1465489 Unintentional integer overflow  put_bits() already asserts a limit in k of 30 indirectly
1500333 Uninitialized scalar variable lpc   should be initialzed in all cases in subframe 0, other subframes follow and thus have it initialized from subframe 0
1505357 Unintentional integer overflow  w*h*4 doesnt overflow



-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240514/e9c44617/attachment.sig>


More information about the ffmpeg-devel mailing list