After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784735 - gst-libav: Memory leak and possible crash in avio_alloc_context.
gst-libav: Memory leak and possible crash in avio_alloc_context.
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
1.12.1
Other All
: Normal critical
: 1.12.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-10 06:04 UTC by Satya Prakash Gupta
Modified: 2017-07-25 08:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch file is attached. (1.78 KB, patch)
2017-07-12 08:55 UTC, Satya Prakash Gupta
committed Details | Review

Description Satya Prakash Gupta 2017-07-10 06:04:46 UTC
Memory leak and possible crash in avio_alloc_context.  

gst-libav-1.12.1/ext/libav/gstavprotocol.c

In function gst_ffmpegdata_open at line: 265 
avio_alloc_context : There is no NULL check while deferring so I think if this function fails i.e return NULL then it should be possible crash and Memory leak of allocated buffer.

Solution: NULL check should be applied before derefer and in case of failure buffer should be freed.

As per API documentation :: Allocated AVIOContext or NULL on failure.

This is for reference https://www.ffmpeg.org/doxygen/2.5/avio_8h.html#a853f5149136a27ffba3207d8520172a5

like above it should be also in function  "gst_ffmpegdata_open" .

Also there  should be NULL check for handle h in "gst_ffmpegdata_close" and same also "gst_ffmpeg_pipe_close"

Please consider it.
Comment 1 Sebastian Dröge (slomo) 2017-07-10 07:05:07 UTC
Can you provide a patch for this?
Comment 2 Satya Prakash Gupta 2017-07-10 10:38:54 UTC
Yes.. I am preparing a patch for it..and soon I will upload it.
Comment 3 Satya Prakash Gupta 2017-07-12 08:55:55 UTC
Created attachment 355396 [details] [review]
Patch file is attached.

Dear Slomo,

Patch file is attached.

With Regards
Satya
Comment 4 Satya Prakash Gupta 2017-07-17 05:03:37 UTC
Please review the attached patch and provide your feedback..
Comment 5 Sebastian Dröge (slomo) 2017-07-17 08:10:09 UTC
commit 98cf1a7e2d27d84041bd4d9a9252d55c1252d010 (HEAD -> master)
Author: Satya Prakash Gupta <sp.gupta@samsung.com>
Date:   Tue Jul 11 11:34:03 2017 +0530

    avdemux/mux: Memory leak and possible crash in avio_alloc_context
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784735