From 1f05deddc88973ba85d98814f3b7f3fc7b37abb8 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 17 Nov 2023 15:01:57 +0100 Subject: [PATCH] fix: Potential error when parsing Intel Hex and Motorola SREC files --- plugins/builtin/source/content/providers/intel_hex_provider.cpp | 2 +- .../builtin/source/content/providers/motorola_srec_provider.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/providers/intel_hex_provider.cpp b/plugins/builtin/source/content/providers/intel_hex_provider.cpp index e3216bc2f..2c8b2dcc2 100644 --- a/plugins/builtin/source/content/providers/intel_hex_provider.cpp +++ b/plugins/builtin/source/content/providers/intel_hex_provider.cpp @@ -49,7 +49,7 @@ namespace hex::plugin::builtin { } recordType; auto c = [&] { - while (std::isspace(string[offset]) && offset < string.length()) + while (offset < string.length() && std::isspace(string[offset])) offset++; if (offset >= string.length()) diff --git a/plugins/builtin/source/content/providers/motorola_srec_provider.cpp b/plugins/builtin/source/content/providers/motorola_srec_provider.cpp index 6f67c4525..1a24d29f7 100644 --- a/plugins/builtin/source/content/providers/motorola_srec_provider.cpp +++ b/plugins/builtin/source/content/providers/motorola_srec_provider.cpp @@ -34,7 +34,7 @@ namespace hex::plugin::builtin { std::vector data; auto c = [&] { - while (std::isspace(string[offset]) && offset < string.length()) + while (offset < string.length() && std::isspace(string[offset])) offset++; if (offset >= string.length())