History

swscale/tests/swscale: Fix potential buffer overflow

The field width in a %s directive gives the amount of characters to read from the input and not the size of the receiving buffer; the latter must be of course also have space for the trailing \0 which has been forgotten here. The commit adds it (and fixes a -Wfortify-source warning from Clang).

Andreas Rheinhardt committed 1 year ago

Commit 65154ba1 parent dff498f1 file · +1 −1Browse files

Unified · Split

libswscale/tests/swscale.c+1−1
@@ -297,7 +297,7 @@ static int run_file_tests(const AVFrame *ref, FILE *fp, struct options opts) · 296 unmodified lines
297 int ret;297 int ret;
298 298
299 while (fgets(buf, sizeof(buf), fp)) {299 while (fgets(buf, sizeof(buf), fp)) {
300 char src_fmt_str[20], dst_fmt_str[20];300 char src_fmt_str[21], dst_fmt_str[21];
301 enum AVPixelFormat src_fmt;301 enum AVPixelFormat src_fmt;
302 enum AVPixelFormat dst_fmt;302 enum AVPixelFormat dst_fmt;
303 int sw, sh, dw, dh, mse[4];303 int sw, sh, dw, dh, mse[4];

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