We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3debab8 commit 78f01f5Copy full SHA for 78f01f5
1 file changed
src/core/hexeditor.cpp
@@ -218,7 +218,12 @@ vector<Match *> HexEditor::findPatterns() {
218
vector<pair<unsigned long, uint8_t>> HexEditor::compareTo(HexEditor &hexEditor) {
219
vector<pair<unsigned long, uint8_t>> diff_bytes;
220
221
- for (unsigned long i = 0; i < this->fileSize; i++) {
+ //Find who has the smaller file size
222
+ unsigned long filesize = this->fileSize;
223
+ if (hexEditor.fileSize < filesize)
224
+ filesize = hexEditor.fileSize;
225
+
226
+ for (unsigned long i = 0; i < filesize; i++) {
227
uint8_t byte_new = hexEditor.getCurrentData()[i];
228
if (this->getCurrentData()[i] != byte_new) {
229
diff_bytes.push_back(pair<unsigned long, uint8_t>(i, byte_new));
0 commit comments