Skip to content

Commit

Permalink
Avoid OOB write
Browse files Browse the repository at this point in the history
When reconstructing chunk table with corrupt chunks, avoid writing out
of bounds

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Mar 2, 2024
1 parent 5bf41de commit 15d4494
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/OpenEXRCore/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,11 @@ reconstruct_chunk_table (
}
}

if (curctable[found_ci] == 0)
curctable[found_ci] = chunk_start;
if (found_ci >= 0 && found_ci < part->chunk_count)
{
if (curctable[found_ci] == 0)
curctable[found_ci] = chunk_start;
}
}
memcpy (chunktable, curctable, chunkbytes);
ctxt->free_fn (curctable);
Expand Down

0 comments on commit 15d4494

Please sign in to comment.