Skip to content

Commit 0641e56

Browse files
committed
Prevent wrap around (Remi Collet at redhat)
1 parent bf3fea9 commit 0641e56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/cdf.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "file.h"
3636

3737
#ifndef lint
38-
FILE_RCSID("@(#)$File: cdf.c,v 1.63 2014/06/09 13:04:37 christos Exp $")
38+
FILE_RCSID("@(#)$File: cdf.c,v 1.64 2014/07/24 19:35:39 christos Exp $")
3939
#endif
4040

4141
#include <assert.h>
@@ -835,6 +835,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
835835
q = (const uint8_t *)(const void *)
836836
((const char *)(const void *)p + ofs
837837
- 2 * sizeof(uint32_t));
838+
if (q < p) {
839+
DPRINTF(("Wrapped around %p < %p\n", q, p));
840+
goto out;
841+
}
838842
if (q > e) {
839843
DPRINTF(("Ran of the end %p > %p\n", q, e));
840844
goto out;

0 commit comments

Comments
 (0)