From 7d696511f010e62a206f0d8e5d4532d0734af948 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date: Wed, 18 May 2011 23:59:38 +0200
Subject: [PATCH] mem: prefer SIZE_MAX over INT_MAX in av_malloc() and av_realloc() checks
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
|
b
|
void *av_malloc(size_t size)
|
| 73 | 73 | #endif |
| 74 | 74 | |
| 75 | 75 | /* let's disallow possible ambiguous cases */ |
| 76 | | if(size > (INT_MAX-32) ) |
| | 76 | if (size > (SIZE_MAX-32)) |
| 77 | 77 | return NULL; |
| 78 | 78 | |
| 79 | 79 | #if CONFIG_MEMALIGN_HACK |
| … |
… |
void *av_realloc(void *ptr, size_t size)
|
| 127 | 127 | #endif |
| 128 | 128 | |
| 129 | 129 | /* let's disallow possible ambiguous cases */ |
| 130 | | if(size > (INT_MAX-16) ) |
| | 130 | if (size > (SIZE_MAX-16)) |
| 131 | 131 | return NULL; |
| 132 | 132 | |
| 133 | 133 | #if CONFIG_MEMALIGN_HACK |