Commit b55cf5f5 authored by Adam Richter's avatar Adam Richter Committed by Michael Niedermayer

libswcale: Fix possible string overflow in test.

In libswcale/tests/swcale.c, the function fileTest() calls sscanf in
an argument of "%12s" on character srcStr[] and dstStr[], which are
only 12 bytes.  So, if the input string is 12 characters, a
terminating null byte can be written past the end of these arrays.

This bug was found by cppcheck.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b8ed4930)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 332de4c1
...@@ -297,10 +297,10 @@ static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp, ...@@ -297,10 +297,10 @@ static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp,
while (fgets(buf, sizeof(buf), fp)) { while (fgets(buf, sizeof(buf), fp)) {
struct Results r; struct Results r;
enum AVPixelFormat srcFormat; enum AVPixelFormat srcFormat;
char srcStr[12]; char srcStr[13];
int srcW = 0, srcH = 0; int srcW = 0, srcH = 0;
enum AVPixelFormat dstFormat; enum AVPixelFormat dstFormat;
char dstStr[12]; char dstStr[13];
int dstW = 0, dstH = 0; int dstW = 0, dstH = 0;
int flags; int flags;
int ret; int ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment