[FFmpeg-devel] [PATCH] mem: prefer SIZE_MAX over INT_MAX in av_malloc() and av_realloc() checks
Stefano Sabatini
stefano.sabatini-lala at poste.it
Thu May 19 00:07:27 CEST 2011
Now the functions accepts size_t size rather than int values, so using
size_t is more correct.
---
libavutil/mem.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 57dc658..17626a1 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -73,7 +73,7 @@ void *av_malloc(size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-32) )
+ if (size > (SIZE_MAX-32))
return NULL;
#if CONFIG_MEMALIGN_HACK
@@ -127,7 +127,7 @@ void *av_realloc(void *ptr, size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-16) )
+ if (size > (SIZE_MAX-16))
return NULL;
#if CONFIG_MEMALIGN_HACK
--
1.7.2.3
More information about the ffmpeg-devel
mailing list