diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2019-10-22 09:30:34 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2019-10-23 11:32:56 +0000 |
commit | 651110de094203859293a82d294f887aef1f167f (patch) | |
tree | 088cd100babf7f52b2ac4cc7dd7a48d524c5e0f7 | |
parent | 8969f02fd59cd6514d5157cf35709525b4a5543f (diff) | |
download | gstreamer-plugins-bad-651110de094203859293a82d294f887aef1f167f.tar.gz |
pnmdec: Return early on ::finish() if we have no actual data to parse
Otherwise we'd be working with a NULL buffer and cause various critical
warnings along the way.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1104
-rw-r--r-- | gst/pnm/gstpnmdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c index 5b624bed4..cf6904e01 100644 --- a/gst/pnm/gstpnmdec.c +++ b/gst/pnm/gstpnmdec.c @@ -244,6 +244,9 @@ gst_pnmdec_parse_ascii (GstPnmdec * s, const guint8 * b, guint bs) GstMapInfo map; guint8 *outdata; + if (!s->buf) + return GST_FLOW_OK; + target = s->size - s->current_size; gst_buffer_map (s->buf, &map, GST_MAP_WRITE); @@ -571,7 +574,7 @@ gst_pnmdec_finish (GstVideoDecoder * decoder) if (s->mngr.info.encoding == GST_PNM_ENCODING_ASCII) { /* One last go at outputting any final value */ gst_pnmdec_parse_ascii (s, 0, 0); - if (s->size <= s->current_size) { + if (s->size && s->size <= s->current_size) { return gst_video_decoder_have_frame (decoder); } } |