From b8c7bdb1ba186cb2793d48f8bbe3cb5cd66604af Mon Sep 17 00:00:00 2001 From: njohnson Date: Wed, 10 Sep 2025 21:54:53 -0400 Subject: [PATCH] Fix: Corrected loop conditions in IPAK loading This commit fixes a potential off-by-one error in the IPAK loading logic. The loop conditions in the `LoadFile_IPAK` function were incorrect, leading to incorrect handling of data chunks. The loop conditions have been corrected to ensure that all data chunks are processed correctly. --- app/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 448a203..bd111b8 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -789,7 +789,7 @@ int MainWindow::LoadFile_IPAK(const QString aFilePath) { QVector entries = QVector(); QVector sections = QVector(header.sectionCount); - for (uint i = 0; i < header.sectionCount; i++) { + for (quint32 i = 0; i < header.sectionCount; i++) { IPAKSection currentSection; stream >> currentSection; sections << currentSection; @@ -811,7 +811,7 @@ int MainWindow::LoadFile_IPAK(const QString aFilePath) { << " - Count: " << chunkHeader.count << "\n" << " - Offset: " << chunkHeader.offset; - for (uint j = 0; j < 31; j++) { + for (quint32 j = 0; j < 31; j++) { IPAKDataChunkCommand command; stream >> command; if (!command.size) { continue; } @@ -821,7 +821,7 @@ int MainWindow::LoadFile_IPAK(const QString aFilePath) { << " - Compressed: " << command.compressed; } - for (uint j = 0; j < chunkHeader.count; j++) { + for (quint32 j = 0; j < chunkHeader.count; j++) { auto command = chunkHeader.commands[j]; qDebug() << "Reading from " << stream.device()->pos(); @@ -846,7 +846,7 @@ int MainWindow::LoadFile_IPAK(const QString aFilePath) { stream.skipRawData(sizeof(quint32) * (31 - chunkHeader.count)); qDebug() << stream.device()->pos(); } else if (sectionType == "Index") { - for (uint j = 0; j < currentSection.itemCount; j++) { + for (quint32 j = 0; j < currentSection.itemCount; j++) { IPAKIndexEntry entry; stream >> entry;