diff mbox

[FFmpeg-devel] avutil/internal: Do not enable CHECKED with DEBUG

Message ID 20170407114909.17696-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer April 7, 2017, 11:49 a.m. UTC
This avoids potential undefined behavior in debug mode while still allowing
developers which want to check for potential additional overflows to do so
by manually enabling this.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavutil/internal.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

wm4 April 7, 2017, 1:23 p.m. UTC | #1
On Fri,  7 Apr 2017 13:49:09 +0200
Michael Niedermayer <michael@niedermayer.cc> wrote:

> This avoids potential undefined behavior in debug mode while still allowing
> developers which want to check for potential additional overflows to do so
> by manually enabling this.
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavutil/internal.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 7780a9a791..70ae37f859 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -30,9 +30,8 @@
>  #    define NDEBUG
>  #endif
>  
> -#if defined(DEBUG) && !defined(CHECKED)
> -#    define CHECKED
> -#endif
> +// This can be enabld to allow detection of additional integer overflows with ubsan
> +//#define CHECKED
>  
>  #include <limits.h>
>  #include <stdint.h>

I think the SUINT stuff should be removed completely, but for now I
think this patch improves the situation, so LGTM.
Ronald S. Bultje April 7, 2017, 4:58 p.m. UTC | #2
Hi,

On Fri, Apr 7, 2017 at 7:49 AM, Michael Niedermayer <michael@niedermayer.cc>
wrote:

> This avoids potential undefined behavior in debug mode while still allowing
> developers which want to check for potential additional overflows to do so
> by manually enabling this.
>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavutil/internal.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 7780a9a791..70ae37f859 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -30,9 +30,8 @@
>  #    define NDEBUG
>  #endif
>
> -#if defined(DEBUG) && !defined(CHECKED)
> -#    define CHECKED
> -#endif
> +// This can be enabld to allow detection of additional integer overflows
> with ubsan
> +//#define CHECKED


s/enabld/enabled/.

Ronald
Michael Niedermayer April 10, 2017, 11:02 p.m. UTC | #3
On Fri, Apr 07, 2017 at 12:58:50PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Fri, Apr 7, 2017 at 7:49 AM, Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > This avoids potential undefined behavior in debug mode while still allowing
> > developers which want to check for potential additional overflows to do so
> > by manually enabling this.
> >
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavutil/internal.h | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavutil/internal.h b/libavutil/internal.h
> > index 7780a9a791..70ae37f859 100644
> > --- a/libavutil/internal.h
> > +++ b/libavutil/internal.h
> > @@ -30,9 +30,8 @@
> >  #    define NDEBUG
> >  #endif
> >
> > -#if defined(DEBUG) && !defined(CHECKED)
> > -#    define CHECKED
> > -#endif
> > +// This can be enabld to allow detection of additional integer overflows
> > with ubsan
> > +//#define CHECKED
> 
> 
> s/enabld/enabled/.

changed

applied

thx

[...]
diff mbox

Patch

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 7780a9a791..70ae37f859 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -30,9 +30,8 @@ 
 #    define NDEBUG
 #endif
 
-#if defined(DEBUG) && !defined(CHECKED)
-#    define CHECKED
-#endif
+// This can be enabld to allow detection of additional integer overflows with ubsan
+//#define CHECKED
 
 #include <limits.h>
 #include <stdint.h>