[Gstreamer-bugs] [Bug 135640] New - Usage of alloca is not portable, and breaks under NetBSD
bugzilla-daemon at widget.gnome.org
bugzilla-daemon at widget.gnome.org
Fri Feb 27 14:27:40 PST 2004
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
http://bugzilla.gnome.org/show_bug.cgi?id=135640
Changed by jmmv at menta.net.
--- shadow/135640 Fri Feb 27 17:27:40 2004
+++ shadow/135640.tmp.9078 Fri Feb 27 17:27:40 2004
@@ -0,0 +1,49 @@
+Bug#: 135640
+Product: GStreamer
+Version: HEAD CVS
+OS: NetBSD
+OS Details:
+Status: NEW
+Resolution:
+Severity: normal
+Priority: Normal
+Component: gst-plugins
+AssignedTo: gstreamer-maint at bugzilla.gnome.org
+ReportedBy: jmmv at menta.net
+QAContact: gstreamer-maint at bugzilla.gnome.org
+TargetMilestone: HEAD
+URL:
+Summary: Usage of alloca is not portable, and breaks under NetBSD
+
+The file gst/interleave/interleave.c uses the alloca(3) function. Even
+though, the code assumes it's present, and also assumes the alloca.h
+header file exists. The later is the one causing problems in NetBSD,
+because the header file to use is stdlib.h, not the missing alloca.h.
+
+According to NetBSD's alloca(3) manpage:
+
+ The alloca() function is machine dependent; its use is discouraged.
+
+ The alloca() function is slightly unsafe because it cannot ensure
+that
+ the pointer returned points to a valid and usable block of memory.
+The
+ allocation made may exceed the bounds of the stack, or even go
+further
+ into other objects in memory, and alloca() cannot determine such an
+ error. Avoid alloca() with large unbounded allocations.
+
+Therefore, I suggest using malloc instead of alloca, since the former is
+standard and less problematic. alloca is used in just one place, so
+converting it to malloc should be easy (if I've understood alloca's
+functionality properly). The attached patch attempts to do this.
+
+If you still want to use alloca, then a check in configure is required.
+The right one to use is AC_FUNC_ALLOCA. Using it implies doing several
+other changes (and also implies having to provide a workaround in case
+it's missing, so we are back to switching to malloc), so I've not done
+this. See autoconf's info manual for more information about this topic.
+(Please note that the manual does not mention stdlib.h containing
+alloca's prototype, so you should #include this file in the source
+unconditionally to be sure it gets defined sometime, in case it's there
+and not in alloca.h.)
More information about the Gstreamer-bugs
mailing list