diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-21 11:22:29 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-21 11:58:09 -0700 |
commit | 506cebe7bffb19f9310565b82231a08cc8e77ece (patch) | |
tree | dd46408c14d69075b37ef2f4ccc8ce270694c3e6 /src | |
parent | dd8c77a0c0d62ab88cf96ac507562469a7bcbc5a (diff) |
XvQueryEncodings: avoid NULL deref if length is 0, but num_encodings is not
Found by gcc 14.1:
Xv.c: In function ‘XvQueryEncodings’:
Xv.c:387:31: warning: dereference of NULL ‘<unknown>’ [CWE-476]
[-Wanalyzer-null-dereference]
387 | pe->encoding_id = u.pe->encoding;
| ~~~~^~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxv/-/merge_requests/7>
Diffstat (limited to 'src')
-rw-r--r-- | src/Xv.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -357,6 +357,10 @@ XvQueryEncodings( } _XRead(dpy, buffer, (long) size); } + else if (rep.num_encodings != 0) { + status = XvBadReply; + goto out; + } /* GET ENCODINGS */ |