diff --git a/src/bitwise.c b/src/bitwise.c index f5ef7912..ad24cf55 100644 --- a/src/bitwise.c +++ b/src/bitwise.c @@ -39,7 +39,7 @@ static const unsigned int mask8B[]= void oggpack_writeinit(oggpack_buffer *b){ memset(b,0,sizeof(*b)); b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT); - b->buffer[0]='\0'; + if(b->buffer) b->buffer[0]='\0'; b->storage=BUFFER_INCREMENT; } diff --git a/src/framing.c b/src/framing.c index 724d116d..499bcc6e 100644 --- a/src/framing.c +++ b/src/framing.c @@ -60,17 +60,17 @@ ogg_int64_t ogg_page_granulepos(const ogg_page *og){ } int ogg_page_serialno(const ogg_page *og){ - return((int)((ogg_uint32_t)og->header[14]) | + return((int)(((ogg_uint32_t)og->header[14]) | ((ogg_uint32_t)og->header[15]<<8) | ((ogg_uint32_t)og->header[16]<<16) | - ((ogg_uint32_t)og->header[17]<<24)); + ((ogg_uint32_t)og->header[17]<<24))); } long ogg_page_pageno(const ogg_page *og){ - return((long)((ogg_uint32_t)og->header[18]) | + return((long)(((ogg_uint32_t)og->header[18]) | ((ogg_uint32_t)og->header[19]<<8) | ((ogg_uint32_t)og->header[20]<<16) | - ((ogg_uint32_t)og->header[21]<<24)); + ((ogg_uint32_t)og->header[21]<<24))); }