malloc failure cases in good plugins

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

malloc failure cases in good plugins

Слободенюк Александр Игоревич
Hello everybody!
 
I have been reading some gst-plugins-good sources and found , that case of
memory allocation failure is tupically ignored there , at least in plugins "pngenc" and "avimux".
 
Example:
 
gst_avi_mux_riff_get_avix_header (guint32 datax_size)
{
  GstBuffer *buffer;
  GstMapInfo map;
 
  buffer = gst_buffer_new_and_alloc (24);
 
  gst_buffer_map (buffer, &map, GST_MAP_WRITE);
  memcpy (map.data + 0, "RIFF", 4);
 
......
.....
 
In my build of glib and gstreamer "gst_buffer_new_and_alloc" after all uses just libc's malloc call. Watched in the debugger.
So, could you please help me to figure out, if that are bugs to be fixed, or I just don't understand (missed) something?
 
Thanks.
 
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: malloc failure cases in good plugins

Слободенюк Александр Игоревич
ok, I see in the documentation, gst_buffer_new_and_alloc will abort in this case...
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 
 
 
07.12.2017, 03:29, "Слободенюк Александр Игоревич" <[hidden email]>:
Hello everybody!
 
I have been reading some gst-plugins-good sources and found , that case of
memory allocation failure is tupically ignored there , at least in plugins "pngenc" and "avimux".
 
Example:
 
gst_avi_mux_riff_get_avix_header (guint32 datax_size)
{
  GstBuffer *buffer;
  GstMapInfo map;
 
  buffer = gst_buffer_new_and_alloc (24);
 
  gst_buffer_map (buffer, &map, GST_MAP_WRITE);
  memcpy (map.data + 0, "RIFF", 4);
 
......
.....
 
In my build of glib and gstreamer "gst_buffer_new_and_alloc" after all uses just libc's malloc call. Watched in the debugger.
So, could you please help me to figure out, if that are bugs to be fixed, or I just don't understand (missed) something?
 
Thanks.
 
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 
,

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: malloc failure cases in good plugins

Nicolas Dufresne-5
In reply to this post by Слободенюк Александр Игоревич
Le jeudi 07 décembre 2017 à 03:19 +0300, Слободенюк Александр Игоревич
a écrit :

> Hello everybody!
>  
> I have been reading some gst-plugins-good sources and found , that
> case of
> memory allocation failure is tupically ignored there , at least in
> plugins "pngenc" and "avimux".
>  
> Example:
>  
> gst_avi_mux_riff_get_avix_header (guint32 datax_size)
> {
>   GstBuffer *buffer;
>   GstMapInfo map;
>  
>   buffer = gst_buffer_new_and_alloc (24);

This is fine, the C Library we use, GLib will abort the application if
we run out of memory. If you run-out of virtual memory, you have a
larger problem, better kill applications before it becomes nasty and
hack-able.

>  
>   gst_buffer_map (buffer, &map, GST_MAP_WRITE);

This though is not has good, we usually always check the return value
of gst_buffer_map(). This case is particular, the buffer/memory has
just been allocated, it's not shared yet, so I don't see how this could
possibly fail.

>   memcpy (map.data + 0, "RIFF", 4);
>  
> ......
> .....
>  
> In my build of glib and gstreamer "gst_buffer_new_and_alloc" after
> all uses just libc's malloc call. Watched in the debugger.
> So, could you please help me to figure out, if that are bugs to be
> fixed, or I just don't understand (missed) something?
>  
> Thanks.
>  
>  
> --
> С уважением,
> Слободенюк Александр Игоревич
>  
> контактный телефон: +7-925-050-64-62
>  
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel