summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-21 11:27:44 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-21 11:58:09 -0700
commitfba7bf352678db2938f5a7b173d2a8823595ef3b (patch)
tree5904d84f93ecf1c6249f5f0e45c111d71da08709
parent506cebe7bffb19f9310565b82231a08cc8e77ece (diff)
XvQueryAdaptors: avoid NULL deref if length is 0, but num_adaptors is notHEADmaster
Found by gcc 14.1: Xv.c: In function ‘XvQueryAdaptors’: Xv.c:222:31: warning: dereference of NULL ‘<unknown>’ [CWE-476] [-Wanalyzer-null-dereference] 222 | pa->type = (char) u.pa->type; | ~~~~^~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxv/-/merge_requests/7>
-rw-r--r--src/Xv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Xv.c b/src/Xv.c
index dc1e5f9..8e4bc17 100644
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -192,6 +192,10 @@ XvQueryAdaptors(
}
_XRead(dpy, buffer, (long) size);
}
+ else if (rep.num_adaptors != 0) {
+ status = XvBadReply;
+ goto out;
+ }
/* GET INPUT ADAPTORS */