Skip to content

Commit 2fe5bcb

Browse files
remicolletsmalyshev
authored andcommitted
Fixed Bug #67413 fileinfo: cdf_read_property_info insufficient boundary chec
Upstream: file/file@93e063e Adapted for C standard.
1 parent 892def5 commit 2fe5bcb

File tree

1 file changed

+5
-1
lines changed
  • ext/fileinfo/libmagic

1 file changed

+5
-1
lines changed

ext/fileinfo/libmagic/cdf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,11 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
812812
if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
813813
goto out;
814814
for (i = 0; i < sh.sh_properties; i++) {
815-
size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
815+
size_t ofs, tail = (i << 1) + 1;
816+
if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
817+
__LINE__) == -1)
818+
goto out;
819+
ofs = CDF_GETUINT32(p, tail);
816820
q = (const uint8_t *)(const void *)
817821
((const char *)(const void *)p + ofs
818822
- 2 * sizeof(uint32_t));

0 commit comments

Comments
 (0)