mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
pngenc: validate input buffer size
Just for safety; of course such mismatch represents a bug in another element.
This commit is contained in:
parent
9eb55c3d8f
commit
7e390c4635
1 changed files with 8 additions and 0 deletions
|
@ -271,6 +271,14 @@ gst_pngenc_chain (GstPad * pad, GstBuffer * buf)
|
|||
|
||||
GST_DEBUG_OBJECT (pngenc, "BEGINNING");
|
||||
|
||||
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < pngenc->height * pngenc->stride)) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (pngenc, STREAM, FORMAT, (NULL),
|
||||
("Provided input buffer is too small, caps problem?"));
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* initialize png struct stuff */
|
||||
pngenc->png_struct_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING,
|
||||
(png_voidp) NULL, user_error_fn, user_warning_fn);
|
||||
|
|
Loading…
Reference in a new issue