mirror of
https://github.com/isledecomp/SIEdit.git
synced 2025-02-17 00:40:42 -05:00
lib: handle case where there aren't enough bytes for padding before an alignment boundary
This commit is contained in:
parent
f37a72b0d1
commit
0443b9e69b
1 changed files with 13 additions and 0 deletions
|
@ -600,6 +600,19 @@ void Interleaf::WriteSubChunk(FileBase *f, uint16_t flags, uint32_t object, uint
|
|||
|
||||
if (start_buffer != stop_buffer) {
|
||||
size_t remaining = ((start_buffer + 1) * m_BufferSize) - f->pos();
|
||||
|
||||
if (remaining < total_hdr) {
|
||||
if (remaining < kMinimumChunkSize) {
|
||||
// There isn't enough space for another chunk, just jump ahead
|
||||
f->seek(remaining, File::SeekCurrent);
|
||||
} else {
|
||||
// This chunk won't fit in our buffer alignment. We must make a decision to either insert
|
||||
// padding or split the clip.
|
||||
WritePadding(f, remaining);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
max_chunk = remaining - total_hdr;
|
||||
|
||||
if (!(flags & MxCh::FLAG_SPLIT)) {
|
||||
|
|
Loading…
Reference in a new issue