Ticket #185: 0001-mem-prefer-SIZE_MAX-over-INT_MAX-in-av_malloc-and-av.patch

File 0001-mem-prefer-SIZE_MAX-over-INT_MAX-in-av_malloc-and-av.patch, 1021 bytes (added by saste, 5 years ago)
  • libavutil/mem.c

    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) 
    7373#endif 
    7474 
    7575    /* let's disallow possible ambiguous cases */ 
    76     if(size > (INT_MAX-32) ) 
     76    if (size > (SIZE_MAX-32)) 
    7777        return NULL; 
    7878 
    7979#if CONFIG_MEMALIGN_HACK 
    void *av_realloc(void *ptr, size_t size) 
    127127#endif 
    128128 
    129129    /* let's disallow possible ambiguous cases */ 
    130     if(size > (INT_MAX-16) ) 
     130    if (size > (SIZE_MAX-16)) 
    131131        return NULL; 
    132132 
    133133#if CONFIG_MEMALIGN_HACK