Skip to content

Commit

Permalink
Abandon magic check with degenerate range (#187)
Browse files Browse the repository at this point in the history
Protects against crashing if track 1 is all zero
  • Loading branch information
hcs64 authored Oct 2, 2024
1 parent 1221bbd commit 50d7c2f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cd/split.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ int32_t byte_offset_by_magic(int32_t lba_start, int32_t lba_end, std::fstream &s
{
int32_t write_offset = std::numeric_limits<int32_t>::max();

if(lba_start > lba_end)
{
return write_offset;
}
const uint32_t sectors_to_check = lba_end - lba_start;

std::vector<uint8_t> data(sectors_to_check * CD_DATA_SIZE);
Expand Down

0 comments on commit 50d7c2f

Please sign in to comment.