<html><head></head><body>Memory debugging is not a specific tool. There were plenty of tools doing it before ASan, many of which are still available. And most likely there will be better alternatives or newer versions of ASan in the future.<br><br>Besides, ASan is neither OS-specific nor architecture-specific.<br><br>And finally, yes, defensive programming does make things much harder to debug since it hides bugs. Exactly what Thomas explained already.<br><br><div class="gmail_quote">Le 19 février 2019 08:48:16 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">My point is that relying on specific tools for a specific OS as the sole solution for code safety have proved insufficient so many times.<br><br>As for the double free issue that would be harder to debug, it's a non issue since double free would never occur with my solution. Why would you need tools to debug it then?<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">On 18 Feb 2019, at 17:38, Rémi Denis-Courmont <remi@remlab.net> wrote:<br><br>Le maanantaina 18. helmikuuta 2019, 17.52.32 EET Steve Lhomme a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">On 18/02/2019 16:32, Thomas Guillem wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;">On Mon, Feb 18, 2019, at 16:11, Steve Lhomme wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">vlc | branch: master | Steve Lhomme <robux4@ycbcr.xyz> | Mon Feb 18<br>14:50:21 2019 +0100| [4a79e6a4929085cd78024e0c0367c2bc01ab11b4] |<br>committer: Steve Lhomme<br><br>decoder: add Destroy helper function for decoder owners<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;"><a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a79e6a4929085cd7">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a79e6a4929085cd7</a><br>8024e0c0367c2bc01ab11b4>> <br></blockquote><hr> include/vlc_codec.h         |  7 +++++++<br> src/input/decoder_helpers.c | 29 +++++++++++++++++++++++++++++<br> src/libvlccore.sym          |  1 +<br> 3 files changed, 37 insertions(+)<br><br>diff --git a/include/vlc_codec.h b/include/vlc_codec.h<br>index c287953ba7..2042ad2424 100644<br>--- a/include/vlc_codec.h<br>+++ b/include/vlc_codec.h<br>@@ -320,6 +320,13 @@ VLC_API void decoder_AbortPictures( decoder_t<br>*dec, bool b_abort );<br><br> VLC_API void decoder_Init( decoder_t *dec, const es_format_t * );<br><br> /**<br><br>+ * Destroy a decoder and reset the structure.<br>+ *<br>+ * To be used by decoder owners.<br>+ */<br>+VLC_API void decoder_Destroy( decoder_t **p_dec );<br>+<br>+/**<br><br>  * This function queues a single picture to the video output.<br>  *<br>  * \note<br><br>diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c<br>index 51f7ce8f6d..b60b830123 100644<br>--- a/src/input/decoder_helpers.c<br>+++ b/src/input/decoder_helpers.c<br>@@ -28,6 +28,8 @@<br><br> #include <vlc_common.h><br> #include <vlc_codec.h><br><br>+#include <vlc_meta.h><br>+#include <vlc_modules.h><br><br> void decoder_Init( decoder_t *p_dec, const es_format_t *restrict p_fmt<br><br>)<br><br> {<br><br>@@ -43,3 +45,30 @@ void decoder_Init( decoder_t *p_dec, const<br>es_format_t *restrict p_fmt )<br><br>     es_format_Copy( &p_dec->fmt_in, p_fmt );<br>     es_format_Init( &p_dec->fmt_out, p_fmt->i_cat, 0 );<br><br> }<br><br>+<br>+static void decoder_Clean( decoder_t *p_dec )<br>+{<br>+    es_format_Clean( &p_dec->fmt_in );<br>+    es_format_Clean( &p_dec->fmt_out );<br>+<br>+    if ( p_dec->p_description )<br>+    {<br>+        vlc_meta_Delete(p_dec->p_description);<br>+        p_dec->p_description = NULL;<br>+    }<br>+    if ( p_dec->p_module != NULL )<br>+    {<br>+        module_unneed(p_dec, p_dec->p_module);<br>+        p_dec->p_module = NULL;<br>+    }<br>+}<br>+<br>+void decoder_Destroy( decoder_t **p_dec )<br>+{<br>+    if (*p_dec != NULL)<br>+    {<br>+        decoder_Clean( *p_dec );<br>+        vlc_object_release( *p_dec );<br>+        *p_dec = NULL;<br>+    }<br></blockquote>I really prefer to use a decoder_t * here.<br>There is not many functions in VLC that set the pointer to NULL. This will<br>add more confusion.<br><br>I really prefer having a crash (via assert/ASAN) when a client is misusing<br>an API (calling Destroy with a freed pointer) instead of ignoring it.<br></blockquote>A double free doesn't always crash on Windows and there's no ASAN.<br></blockquote>So your point is that because the bug is hard to observe on Windows, it should <br>be made hard to observe everywhere? This is punishing everybody for your <br>personal selection of development environment. What the hell...<br><br>-- <br>雷米‧德尼-库尔蒙<br><a href="http://www.remlab.net/">http://www.remlab.net/</a><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>