summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2022-11-16 15:17:30 +0200
committerOleg Oshmyan <chortos@inbox.lv>2022-11-16 15:45:18 +0200
commit0199434b80bd1602dc0ef61fa206d2c95676028d (patch)
treeaed10c7ed19d68ff7eaf827359dc5581cb3c4f7d /libass
parentb5cdc695e3049b71985be3a0ce14a4b804ace8f1 (diff)
downloadlibass-coverity_scan.tar.bz2
libass-coverity_scan.tar.xz
compare: don't call qsort on NULL arraycoverity_scan
This works in practice but is explicitly forbidden in C99, C11 and C17 alike: > 7.20.5/7.22.5 Searching and sorting utilities > > [...] Where an argument declared as size_t nmemb specifies the length > of the array for a function, nmemb can have the value zero on a call to > that function; the comparison function is not called, [...] and sorting > performs no rearrangement. Pointer arguments on such a call shall still > have valid values, as described in 7.1.4. > 7.1.4 Use of library functions > > [...] If an argument to a function has an invalid value (such as [...] > a null pointer [...]) [...], the behavior is undefined. If a function > argument is described as being an array, the pointer actually passed > to the function shall have a value such that all address computations > and accesses to objects (that would be valid if the pointer did point > to the first element of such an array) are in fact valid. In contrast, qsort_s explicitly allows the array pointer argument to be NULL when nmemb == 0 (see C11/C17 K.3.6.3 Searching and sorting utilities).
Diffstat (limited to 'libass')
0 files changed, 0 insertions, 0 deletions