projects
/
platform
/
upstream
/
gstreamer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d109dd2
)
Check buffer size before checking buffer data
author
Xavier Claessens
<xavier.claessens@collabora.com>
Mon, 23 Sep 2019 15:19:07 +0000
(11:19 -0400)
committer
Xavier Claessens
<xclaesse@gmail.com>
Mon, 7 Oct 2019 17:47:47 +0000
(17:47 +0000)
If the expected size is bigger than the actual buffer size, it would
memcmp random memory which could lead to crashes instead of proper error
reporting.
libs/gst/check/gstcheck.c
patch
|
blob
|
history
diff --git
a/libs/gst/check/gstcheck.c
b/libs/gst/check/gstcheck.c
index
a6e82bc
..
4f784c8
100644
(file)
--- a/
libs/gst/check/gstcheck.c
+++ b/
libs/gst/check/gstcheck.c
@@
-801,6
+801,10
@@
gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size)
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
GST_MEMDUMP ("Converted data", info.data, info.size);
GST_MEMDUMP ("Expected data", data, size);
+ if (info.size != size) {
+ fail ("buffer sizes not equal: expected %" G_GSIZE_FORMAT " got %"
+ G_GSIZE_FORMAT, size, info.size);
+ }
if (memcmp (info.data, data, size) != 0) {
g_print ("\nConverted data:\n");
gst_util_dump_mem (info.data, info.size);