Showing the changes to src/vm/module_reader.cpp (1 of 9 files). Show all
Unified · Split
| @@ -216,8 +216,6 @@ namespace · 215 unmodified lines | |||
| 216 | if (!success) | 216 | if (!success) |
| 217 | throw module_reader_exception{ "Failed to read magic number" }; | 217 | throw module_reader_exception{ "Failed to read magic number" }; |
| 218 | 218 | ||
| 219 | assert(header.magic_number == magic_number_constants::xmagic || header.magic_number == magic_number_constants::smagic); | ||
| 220 | |||
| 221 | // If the object file is signed, read in the signature. | 219 | // If the object file is signed, read in the signature. |
| 222 | if (header.magic_number == magic_number_constants::smagic) | 220 | if (header.magic_number == magic_number_constants::smagic) |
| 223 | { | 221 | { |
| @@ -228,10 +226,14 @@ namespace · 4 unmodified lines | |||
| 228 | const auto bytesRead = reader.get_next_bytes(header.Signature.length, header.Signature.signature.get()); | 226 | const auto bytesRead = reader.get_next_bytes(header.Signature.length, header.Signature.signature.get()); |
| 229 | if (bytesRead != header.Signature.length) throw module_reader_exception{ "Failed to read full signature" }; | 227 | if (bytesRead != header.Signature.length) throw module_reader_exception{ "Failed to read full signature" }; |
| 230 | } | 228 | } |
| 231 | else | 229 | else if (header.magic_number == magic_number_constants::xmagic) |
| 232 | { | 230 | { |
| 233 | header.Signature.length = word_t{ 0 }; | 231 | header.Signature.length = word_t{ 0 }; |
| 234 | } | 232 | } |
| 233 | else | ||
| 234 | { | ||
| 235 | throw module_reader_exception{ "Invalid magic number in module" }; | ||
| 236 | } | ||
| 235 | 237 | ||
| 236 | auto runtime_flags = operand_t{}; | 238 | auto runtime_flags = operand_t{}; |
| 237 | std::tie(success, runtime_flags) = read_next_operand(reader); | 239 | std::tie(success, runtime_flags) = read_next_operand(reader); |