[vlc-devel] [PATCH] network: fix clamping (cid #1420607)

Rémi Denis-Courmont remi at remlab.net
Mon Nov 6 09:56:25 CET 2017


Le 6 novembre 2017 07:21:27 GMT+02:00, Tristan Matthews <tmatth at videolan.org> a écrit :
>---
> src/network/tcp.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/src/network/tcp.c b/src/network/tcp.c
>index bc2a116532..51b275d238 100644
>--- a/src/network/tcp.c
>+++ b/src/network/tcp.c
>@@ -177,9 +177,7 @@ int net_Connect( vlc_object_t *p_this, const char
>*psz_host, int i_port,
> 
>                 if (deadline != VLC_TS_INVALID)
>                 {
>-                    ms = (deadline - mdate()) / (CLOCK_FREQ / 1000);
>-                    if (ms > INT_MAX)
>-                        ms = INT_MAX;
>+                    ms = __MIN((deadline - mdate()) / (CLOCK_FREQ /
>1000), INT_MAX);
>                 }
> 
>                 val = vlc_poll_i11e(&ufd, 1, ms);
>-- 
>2.15.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

This is wrong because the macro is not expansion-safe. Also, it attempts to solve a different issue than the one Coverity found.
-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.


More information about the vlc-devel mailing list