freebsd-ports/audio/flac/files/patch-src_libFLAC_format.c
Christian Weisgerber 18adb14800 Fix integer overflows (CVE-2007-4619) by backporting corresponding
fixes from FLAC 1.2.1.

Reviewed by:    miwi
Approved by:    portmgr (linimon)
Security: 	ff65eecb-91e4-11dc-bd6c-0016179b2dd5
2007-11-13 14:28:29 +00:00

25 lines
975 B
C

$FreeBSD$
--- src/libFLAC/format.c.orig
+++ src/libFLAC/format.c
@@ -38,6 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include "share/alloc.h"
#ifdef min
#undef min
@@ -463,9 +464,9 @@
FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
if(object->capacity_by_order < max_partition_order) {
- if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->parameters = (unsigned*)safe_realloc_mul_2op_(object->parameters, sizeof(unsigned), /*times*/(1 << max_partition_order))))
return false;
- if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->raw_bits = (unsigned*)safe_realloc_mul_2op_(object->raw_bits, sizeof(unsigned), /*times*/(1 << max_partition_order))))
return false;
object->capacity_by_order = max_partition_order;
}