Skip to content

Commit 7ca96ea

Browse files
committed
Fixed another instance of reinterpret_cast<>()-based UB
1 parent 60559c7 commit 7ca96ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reader.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ struct chunkStream_t final : public stream_t
6868
const size_t amount = valueDelta > chunkDelta ? chunkDelta : valueDelta;
6969
if (isSequence && pos == 0)
7070
{
71-
const uint32_t sequenceNum = *reinterpret_cast<const uint32_t *>(_chunks[chunk]->data());
72-
if (swap32(sequenceNum) != ++sequenceIndex)
71+
const uint32_t sequenceNum = read32(_chunks[chunk]->data());
72+
if (sequenceNum != ++sequenceIndex)
7373
throw invalidPNG_t{};
7474
}
7575

0 commit comments

Comments
 (0)