Opened 5 weeks ago

Last modified 5 weeks ago

#6746 new defect

libpostproc/postprocess.c: 2 * array index sanity check in odd place ?

Reported by: dcb Owned by:
Priority: normal Component: postproc
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

[ffmpeg-3.4/libpostproc/postprocess.c:804]: (style) Array index 'o' is used before limits check.
[ffmpeg-3.4/libpostproc/postprocess.c:818]: (style) Array index 'o' is used before limits check.

Source code is

for(o=0; options[o] && o<2; o++){

and

for(o=0; options[o] && o<1; o++){

Change History (1)

comment:1 Changed 5 weeks ago by heleppkes

The array is NULL terminated, the first condition will stop the loop before anything bad happens, so the order doesn't really make any difference. It just limits the number of loop executions.

Note: See TracTickets for help on using tickets.