[vlc-devel] [PATCH] vlc_strftime: avoid infinite loop on windows when format string is invalid

Rémi Denis-Courmont remi at remlab.net
Thu Jan 25 16:56:26 CET 2018


Le 25 janvier 2018 15:44:12 GMT+02:00, Pierre Lamot <pierre at videolabs.io> a écrit :
>---
> src/text/strings.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/src/text/strings.c b/src/text/strings.c
>index 4b282bb397..cc26745f07 100644
>--- a/src/text/strings.c
>+++ b/src/text/strings.c
>@@ -506,6 +506,13 @@ char *vlc_strftime( const char *tformat )
>             char *ret = realloc (str, len + 1);
>             return ret ? ret : str; /* <- this cannot fail */
>         }
>+#ifdef _WIN32
>+        else if ( errno == EINVAL ) /* ie: invalid tformat */
>+        {
>+            free(str);
>+            return NULL;
>+        }
>+#endif
>         free (str);
>     }
>     vlc_assert_unreachable ();
>-- 
>2.14.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

The problem is not really specific to Windows, is it? You cannot rely on Windows or glibc extensions then (and I don't see why you would need to either but I have not tried).
-- 
Remi Denis-Courmont


More information about the vlc-devel mailing list