diff --git a/media/libogg/CHANGES b/media/libogg/CHANGES --- a/media/libogg/CHANGES +++ b/media/libogg/CHANGES @@ -1,5 +1,15 @@ +Version 1.3.6 (2025 June 16) + + * Update minimum cmake version to 3.6 + This fixes incompatibility with cmake >= 4.0 + * Fix UBsan issues + * Improve allocation failure handling + * Fix various compiler warnings + * Fix various autotool warnings + * Improve continuous integration testing scripts + Version 1.3.5 (2020 June 3) * Fix unsigned typedef problem on macOS. * Fix overflow check in ogg_sync_buffer. * Clean up cmake and autotools build files. diff --git a/media/libogg/include/ogg/ogg.h b/media/libogg/include/ogg/ogg.h --- a/media/libogg/include/ogg/ogg.h +++ b/media/libogg/include/ogg/ogg.h @@ -199,14 +199,10 @@ extern long ogg_page_pageno(const ogg_page *og); extern int ogg_page_packets(const ogg_page *og); extern void ogg_packet_clear(ogg_packet *op); -extern void ogg_set_mem_functions(ogg_malloc_function_type *malloc_func, - ogg_calloc_function_type *calloc_func, - ogg_realloc_function_type *realloc_func, - ogg_free_function_type *free_func); #ifdef __cplusplus } #endif diff --git a/media/libogg/include/ogg/os_types.h b/media/libogg/include/ogg/os_types.h --- a/media/libogg/include/ogg/os_types.h +++ b/media/libogg/include/ogg/os_types.h @@ -14,37 +14,16 @@ ********************************************************************/ #ifndef _OS_TYPES_H #define _OS_TYPES_H -#include - -/* We indirect mallocs through settable-at-runtime functions to accommodate - memory reporting in the browser. */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void* (ogg_malloc_function_type)(size_t); -typedef void* (ogg_calloc_function_type)(size_t, size_t); -typedef void* (ogg_realloc_function_type)(void*, size_t); -typedef void (ogg_free_function_type)(void*); - -extern ogg_malloc_function_type *ogg_malloc_func; -extern ogg_calloc_function_type *ogg_calloc_func; -extern ogg_realloc_function_type *ogg_realloc_func; -extern ogg_free_function_type *ogg_free_func; - -#ifdef __cplusplus -} -#endif - -#define _ogg_malloc ogg_malloc_func -#define _ogg_calloc ogg_calloc_func -#define _ogg_realloc ogg_realloc_func -#define _ogg_free ogg_free_func +/* make it easy on the folks that want to compile the libs with a + different malloc than stdlib */ +#define _ogg_malloc malloc +#define _ogg_calloc calloc +#define _ogg_realloc realloc +#define _ogg_free free #if defined(_WIN32) # if defined(__CYGWIN__) # include diff --git a/media/libogg/moz.yaml b/media/libogg/moz.yaml --- a/media/libogg/moz.yaml +++ b/media/libogg/moz.yaml @@ -8,12 +8,12 @@ name: libogg description: multimedia container format url: https://www.xiph.org/ogg/ - release: v1.3.5 (2021-06-03T16:38:31-07:00). - revision: v1.3.5 + release: v1.3.6 (2025-06-16T11:55:41-04:00). + revision: v1.3.6 license: BSD-3-Clause license-file: COPYING vendoring: diff --git a/media/libogg/src/ogg_alloc.c b/media/libogg/src/ogg_alloc.c deleted file mode 100644 --- a/media/libogg/src/ogg_alloc.c +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - *********************************************************************/ - -#include -#include "ogg/os_types.h" - -ogg_malloc_function_type *ogg_malloc_func = malloc; -ogg_calloc_function_type *ogg_calloc_func = calloc; -ogg_realloc_function_type *ogg_realloc_func = realloc; -ogg_free_function_type *ogg_free_func = free; - -void -ogg_set_mem_functions(ogg_malloc_function_type *malloc_func, - ogg_calloc_function_type *calloc_func, - ogg_realloc_function_type *realloc_func, - ogg_free_function_type *free_func) -{ - ogg_malloc_func = malloc_func; - ogg_calloc_func = calloc_func; - ogg_realloc_func = realloc_func; - ogg_free_func = free_func; -} diff --git a/media/libogg/src/ogg_bitwise.c b/media/libogg/src/ogg_bitwise.c --- a/media/libogg/src/ogg_bitwise.c +++ b/media/libogg/src/ogg_bitwise.c @@ -37,10 +37,12 @@ {0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; void oggpack_writeinit(oggpack_buffer *b){ memset(b,0,sizeof(*b)); b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT); + if (!b->buffer) + return; b->buffer[0]='\0'; b->storage=BUFFER_INCREMENT; } void oggpackB_writeinit(oggpack_buffer *b){ @@ -282,17 +284,17 @@ else if(!bits)return(0L); } ret=b->ptr[0]>>b->endbit; if(bits>8){ - ret|=b->ptr[1]<<(8-b->endbit); + ret|=(unsigned long)b->ptr[1]<<(8-b->endbit); if(bits>16){ - ret|=b->ptr[2]<<(16-b->endbit); + ret|=(unsigned long)b->ptr[2]<<(16-b->endbit); if(bits>24){ - ret|=b->ptr[3]<<(24-b->endbit); + ret|=(unsigned long)b->ptr[3]<<(24-b->endbit); if(bits>32 && b->endbit) - ret|=b->ptr[4]<<(32-b->endbit); + ret|=(unsigned long)b->ptr[4]<<(32-b->endbit); } } } return(m&ret); } @@ -311,17 +313,17 @@ /* special case to avoid reading b->ptr[0], which might be past the end of the buffer; also skips some useless accounting */ else if(!bits)return(0L); } - ret=b->ptr[0]<<(24+b->endbit); + ret=(unsigned long)b->ptr[0]<<(24+b->endbit); if(bits>8){ - ret|=b->ptr[1]<<(16+b->endbit); + ret|=(unsigned long)b->ptr[1]<<(16+b->endbit); if(bits>16){ - ret|=b->ptr[2]<<(8+b->endbit); + ret|=(unsigned long)b->ptr[2]<<(8+b->endbit); if(bits>24){ - ret|=b->ptr[3]<<(b->endbit); + ret|=(unsigned long)b->ptr[3]<<(b->endbit); if(bits>32 && b->endbit) ret|=b->ptr[4]>>(8-b->endbit); } } } @@ -387,17 +389,17 @@ else if(!bits)return(0L); } ret=b->ptr[0]>>b->endbit; if(bits>8){ - ret|=b->ptr[1]<<(8-b->endbit); + ret|=(unsigned long)b->ptr[1]<<(8-b->endbit); if(bits>16){ - ret|=b->ptr[2]<<(16-b->endbit); + ret|=(unsigned long)b->ptr[2]<<(16-b->endbit); if(bits>24){ - ret|=b->ptr[3]<<(24-b->endbit); + ret|=(unsigned long)b->ptr[3]<<(24-b->endbit); if(bits>32 && b->endbit){ - ret|=b->ptr[4]<<(32-b->endbit); + ret|=(unsigned long)b->ptr[4]<<(32-b->endbit); } } } } ret&=m; @@ -428,17 +430,17 @@ /* special case to avoid reading b->ptr[0], which might be past the end of the buffer; also skips some useless accounting */ else if(!bits)return(0L); } - ret=b->ptr[0]<<(24+b->endbit); + ret=(unsigned long)b->ptr[0]<<(24+b->endbit); if(bits>8){ - ret|=b->ptr[1]<<(16+b->endbit); + ret|=(unsigned long)b->ptr[1]<<(16+b->endbit); if(bits>16){ - ret|=b->ptr[2]<<(8+b->endbit); + ret|=(unsigned long)b->ptr[2]<<(8+b->endbit); if(bits>24){ - ret|=b->ptr[3]<<(b->endbit); + ret|=(unsigned long)b->ptr[3]<<(b->endbit); if(bits>32 && b->endbit) ret|=b->ptr[4]>>(8-b->endbit); } } } @@ -563,21 +565,21 @@ oggpack_readinit(&r,buffer,bytes); for(i=0;ilacing_fill>255?255:os->lacing_fill); + int maxvals; int bytes=0; long acc=0; ogg_int64_t granule_pos=-1; if(ogg_stream_check(os)) return(0); + maxvals=(os->lacing_fill>255?255:os->lacing_fill); if(maxvals==0) return(0); /* construct a page */ /* decide how many segments to include */ @@ -637,16 +638,19 @@ n) page synced at current location; page length n bytes */ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ - unsigned char *page=oy->data+oy->returned; + unsigned char *page; unsigned char *next; - long bytes=oy->fill-oy->returned; + long bytes; if(ogg_sync_check(oy))return 0; + page=oy->data+oy->returned; + bytes=oy->fill-oy->returned; + if(oy->headerbytes==0){ int headerbytes,i; if(bytes<27)return(0); /* not enough for a header */ /* verify capture pattern */ @@ -1084,15 +1088,15 @@ fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n", og->header[0],og->header[1],og->header[2],og->header[3], (int)og->header[4],(int)og->header[5]); fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n", - (og->header[9]<<24)|(og->header[8]<<16)| + ((unsigned)og->header[9]<<24)|(og->header[8]<<16)| (og->header[7]<<8)|og->header[6], - (og->header[17]<<24)|(og->header[16]<<16)| + ((unsigned)og->header[17]<<24)|(og->header[16]<<16)| (og->header[15]<<8)|og->header[14], - ((long)(og->header[21])<<24)|(og->header[20]<<16)| + ((long)((unsigned)og->header[21])<<24)|(og->header[20]<<16)| (og->header[19]<<8)|og->header[18]); fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (", (int)og->header[22],(int)og->header[23], (int)og->header[24],(int)og->header[25], @@ -1101,23 +1105,30 @@ for(j=27;jheader_len;j++) fprintf(stderr,"%d ",(int)og->header[j]); fprintf(stderr,")\n\n"); } -void copy_page(ogg_page *og){ +static int copy_page(ogg_page *og){ unsigned char *temp=_ogg_malloc(og->header_len); + if (!temp) + return -1; memcpy(temp,og->header,og->header_len); og->header=temp; temp=_ogg_malloc(og->body_len); + if (!temp) + return -1; memcpy(temp,og->body,og->body_len); og->body=temp; + return 0; } -void free_page(ogg_page *og){ +static void free_page(ogg_page *og){ _ogg_free (og->header); + og->header=NULL; _ogg_free (og->body); + og->body=NULL; } void error(void){ fprintf(stderr,"error!\n"); exit(1); @@ -1496,10 +1507,15 @@ int eosflag=0; int bosflag=0; int byteskipcount=0; + if (!data) { + fprintf(stderr,"unable to allocate requried data buffer!\n"); + exit(1); + } + ogg_stream_reset(&os_en); ogg_stream_reset(&os_de); ogg_sync_reset(&oy); for(packets=0;packets