| ... | @@ -1,5 +1,3 @@ | ... | @@ -1,5 +1,3 @@ |
| 1 | //! Minimal UBSan Runtime | | |
| 2 | | | |
| 3 | const std = @import("std"); | 1 | const std = @import("std"); |
| 4 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 5 | const assert = std.debug.assert; | 3 | const assert = std.debug.assert; |
| ... | @@ -471,7 +469,7 @@ fn floatCastOverflow( | ... | @@ -471,7 +469,7 @@ fn floatCastOverflow( |
| 471 | // See: https://github.com/llvm/llvm-project/blob/release/19.x/compiler-rt/lib/ubsan/ubsan_handlers.cpp#L463 | 469 | // See: https://github.com/llvm/llvm-project/blob/release/19.x/compiler-rt/lib/ubsan/ubsan_handlers.cpp#L463 |
| 472 | // for more information on this check. | 470 | // for more information on this check. |
| 473 | const ptr: [*]const u8 = @ptrCast(data_handle); | 471 | const ptr: [*]const u8 = @ptrCast(data_handle); |
| 474 | if (ptr[0] + ptr[1] < 2 or ptr[0] == 0xFF or ptr[1] == 0xFF) { | 472 | if (@as(u16, ptr[0]) + @as(u16, ptr[1]) < 2 or ptr[0] == 0xFF or ptr[1] == 0xFF) { |
| 475 | const data: *const FloatCastOverflowData = @ptrCast(data_handle); | 473 | const data: *const FloatCastOverflowData = @ptrCast(data_handle); |
| 476 | const from_value: Value = .{ .handle = from_handle, .type_descriptor = data.from }; | 474 | const from_value: Value = .{ .handle = from_handle, .type_descriptor = data.from }; |
| 477 | logMessage("{} is outside the range of representable values of type {s}", .{ | 475 | logMessage("{} is outside the range of representable values of type {s}", .{ |