History

avfilter/vf_ssim360: Use correct type in sizeof

SSIM360Context.ssim360_hist is an array of four pointers to double; so sizeof(*ssim360_hist[0]) (=sizeof(double)) is the correct size to use to calculate the amount of memory to allocate, not sizeof(*ssim360_hist) (which is sizeof(double*)). Use FF_ALLOCZ_TYPED_ARRAY to avoid this issue altogether. Fixes Coverity issue #1520671.

Andreas Rheinhardt committed 3 years ago

Commit 10919631 parent 41750221 file · +1 −1Browse files

Unified · Split

libavfilter/vf_ssim360.c+1−1
@@ -1624,7 +1624,7 @@ static int config_output(AVFilterLink *outlink) · 1623 unmodified lines
1624 memset(s->ssim360_percentile_sum, 0, sizeof(s->ssim360_percentile_sum));1624 memset(s->ssim360_percentile_sum, 0, sizeof(s->ssim360_percentile_sum));
1625 1625
1626 for (int i = 0; i < s->nb_components; i++) {1626 for (int i = 0; i < s->nb_components; i++) {
1627 s->ssim360_hist[i] = av_calloc(SSIM360_HIST_SIZE, sizeof(*s->ssim360_hist));1627 FF_ALLOCZ_TYPED_ARRAY(s->ssim360_hist[i], SSIM360_HIST_SIZE);
1628 if (!s->ssim360_hist[i])1628 if (!s->ssim360_hist[i])
1629 return AVERROR(ENOMEM);1629 return AVERROR(ENOMEM);
1630 }1630 }

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