freebsd-ports/audio/flac/files/patch-src_libOggFLAC_ogg__helper.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

31 lines
1 KiB
C

$FreeBSD$
--- src/libOggFLAC/ogg_helper.c.orig
+++ src/libOggFLAC/ogg_helper.c
@@ -34,6 +34,7 @@
#include "FLAC/assert.h"
#include "private/ogg_helper.h"
#include "protected/seekable_stream_encoder.h"
+#include "share/alloc.h"
static FLAC__bool full_read_(OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte *buffer, unsigned bytes, OggFLAC__SeekableStreamEncoderReadCallback read_callback, void *client_data)
@@ -102,7 +103,7 @@
}
/* allocate space for the page header */
- if(0 == (page->header = (unsigned char *)malloc(OGG_MAX_HEADER_LEN))) {
+ if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) {
encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -144,7 +145,7 @@
}
/* allocate space for the page body */
- if(0 == (page->body = (unsigned char *)malloc(page->body_len))) {
+ if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) {
encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}