Opened 16 months ago
Closed 15 months ago
#11620 closed defect (fixed)
av_malloc_array() and av_realloc_array(): nmemb and size arguments transposed
| Reported by: | francoisk | Owned by: | |
|---|---|---|---|
| Priority: | minor | Component: | avutil |
| Version: | git-master | Keywords: | memory |
| Cc: | francoisk | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description (last modified by )
At line 356 of libavutil/frame.c is the following call to av_malloc_array:
dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch);
Looks like the arguments are the wrong way around. First is nmemb and second is the size of each member:
av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
Same goes for the call to av_realloc_array() at line 425 of the same file:
tmp = av_realloc_array(dst->extended_buf, sizeof(*dst->extended_buf),
src->nb_extended_buf);
This was flagged by gcc's -Wcalloc-transposed-args.
Change History (3)
comment:1 by , 16 months ago
| Description: | modified (diff) |
|---|---|
| Summary: | av_malloc_array(): nmemb and size arguments transposed → av_malloc_array() and av_realloc_array(): nmemb and size arguments transposed |
comment:2 by , 16 months ago
comment:3 by , 15 months ago
| Priority: | normal → minor |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Fixed in 834bedf3121e9f9d551abb7994b87e630bf5fa5a and preceding commits.
Notice that I could not find any instance of this issue in ffv1dec.c.
Note:
See TracTickets
for help on using tickets.



Also in: