From: Sebastian Dröge Date: Tue, 22 Oct 2019 06:30:34 +0000 (+0300) Subject: pnmdec: Return early on ::finish() if we have no actual data to parse X-Git-Tag: 1.16.2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70e44a459809488df59f65b861dab712e446262c;p=platform%2Fupstream%2Fgst-plugins-bad.git 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 --- diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c index 5b624be..cf6904e 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); } }