History

avfilter/vf_signalstats: Use 64bit for processing histogram

The result might not fit into 32bit if an image has gigantic dimensions and one of the planes has a dominant value (particularly so if said value is big). Fixes Coverity issues #1598399, #1598401, #1598402, #1598403, #1598404.

Andreas Rheinhardt committed 2 years ago

Commit dfd03201 parent 4008a801 file · +5 −5Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_signalstats.c+5−5
@@ -721,10 +721,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 720 unmodified lines
721721 if (histv[fil]) maxv = fil;
722722 if (histsat[fil]) maxsat = fil;
723723
724− toty += histy[fil] * fil;
725− totu += histu[fil] * fil;
726− totv += histv[fil] * fil;
727− totsat += histsat[fil] * fil;
724+ toty += (uint64_t)histy[fil] * fil;
725+ totu += (uint64_t)histu[fil] * fil;
726+ totv += (uint64_t)histv[fil] * fil;
727+ totsat += (uint64_t)histsat[fil] * fil;
728728
729729 accy += histy[fil];
730730 accu += histu[fil];
@@ -745,7 +745,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 14 unmodified lines
745745 maxhue = histhue[0];
746746 medhue = -1;
747747 for (fil = 0; fil < 360; fil++) {
748− tothue += histhue[fil] * fil;
748+ tothue += (uint64_t)histhue[fil] * fil;
749749 acchue += histhue[fil];
750750
751751 if (medhue == -1 && acchue > s->cfs / 2)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t