riff, aiff: fixed "limited range" gcc warning
On 32 bit systems with large file support enabled (i.e. "sizeof(off_t) > sizeof(size_t)") gcc emits a warning because a size_t cast to off_t can never become negative.
This commit is contained in:
parent
a1d868eb56
commit
9a3f5ff977
2
NEWS
2
NEWS
@ -1,6 +1,8 @@
|
|||||||
ver 0.15.5 (2009/??/??)
|
ver 0.15.5 (2009/??/??)
|
||||||
* input:
|
* input:
|
||||||
- curl: don't abort if a packet has only metadata
|
- curl: don't abort if a packet has only metadata
|
||||||
|
* tags:
|
||||||
|
- riff, aiff: fixed "limited range" gcc warning
|
||||||
* decoder_thread: change the fallback decoder name to "mad"
|
* decoder_thread: change the fallback decoder name to "mad"
|
||||||
|
|
||||||
|
|
||||||
|
10
src/aiff.c
10
src/aiff.c
@ -84,6 +84,11 @@ aiff_seek_id3(FILE *file)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = GUINT32_FROM_BE(chunk.size);
|
size = GUINT32_FROM_BE(chunk.size);
|
||||||
|
if (size > G_MAXINT32)
|
||||||
|
/* too dangerous, bail out: possible integer
|
||||||
|
underflow when casting to off_t */
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (size % 2 != 0)
|
if (size % 2 != 0)
|
||||||
/* pad byte */
|
/* pad byte */
|
||||||
++size;
|
++size;
|
||||||
@ -92,11 +97,6 @@ aiff_seek_id3(FILE *file)
|
|||||||
/* found it! */
|
/* found it! */
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
if ((off_t)size < 0)
|
|
||||||
/* integer underflow after cast to signed
|
|
||||||
type */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = fseek(file, size, SEEK_CUR);
|
ret = fseek(file, size, SEEK_CUR);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
10
src/riff.c
10
src/riff.c
@ -83,6 +83,11 @@ riff_seek_id3(FILE *file)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = GUINT32_FROM_LE(chunk.size);
|
size = GUINT32_FROM_LE(chunk.size);
|
||||||
|
if (size > G_MAXINT32)
|
||||||
|
/* too dangerous, bail out: possible integer
|
||||||
|
underflow when casting to off_t */
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (size % 2 != 0)
|
if (size % 2 != 0)
|
||||||
/* pad byte */
|
/* pad byte */
|
||||||
++size;
|
++size;
|
||||||
@ -91,11 +96,6 @@ riff_seek_id3(FILE *file)
|
|||||||
/* found it! */
|
/* found it! */
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
if ((off_t)size < 0)
|
|
||||||
/* integer underflow after cast to signed
|
|
||||||
type */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = fseek(file, size, SEEK_CUR);
|
ret = fseek(file, size, SEEK_CUR);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user