r00ster91
297b5d1074
fix [x]u65529 and above overflowing
...
```
$ cat overflow.zig
test {
var a: [1]u65535 = undefined;
_ = a;
}
$ zig-out/bin/zig test overflow.zig
thread 290266 panic: integer overflow
zig/src/type.zig:3604:55: 0xada43d in intAbiAlignment (zig)
std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8),
^
zig/src/type.zig:3598:42: 0xadd4ea in intAbiSize (zig)
const alignment = intAbiAlignment(bits, target);
^
zig/src/type.zig:3500:61: 0x92be91 in abiSizeAdvanced (zig)
return AbiSizeAdvanced{ .scalar = intAbiSize(bits, target) };
^
zig/src/type.zig:3385:62: 0x928933 in abiSizeAdvanced (zig)
switch (try payload.elem_type.abiSizeAdvanced(target, strat)) {
^
zig/src/type.zig:3268:32: 0x92c012 in abiSize (zig)
return (abiSizeAdvanced(ty, target, .eager) catch unreachable).scalar;
^
```
This is only noticed in a debug build of zig and silently does the wrong
thing and overflows in release builds.
This happened to `[x]u65529` and above because of the ` + 7` on a `u16`.
2023-05-09 11:58:34 +03:00
..
2023-05-08 07:36:19 -04:00
2022-12-10 21:51:46 +07:00
2023-05-01 19:22:52 -04:00
2022-12-27 21:17:52 +08:00
2023-04-28 16:45:37 -07:00
2023-02-21 15:46:34 -05:00
2022-12-06 19:06:48 -07:00
2023-05-01 19:22:52 -04:00
2022-12-06 19:06:48 -07:00
2023-05-09 11:58:34 +03:00
2023-03-15 01:04:21 -04:00
2023-04-02 04:49:53 -04:00
2023-03-15 01:04:21 -04:00
2021-10-28 17:33:05 -07:00
2023-04-25 11:23:41 -07:00
2023-03-15 01:04:21 -04:00
2023-03-15 01:04:21 -04:00
2023-03-21 08:49:54 +01:00
2023-04-02 04:49:53 -04:00
2023-05-03 04:25:14 -04:00
2023-05-08 10:59:06 +03:00
2023-04-07 01:29:20 +01:00
2022-02-13 14:42:20 +02:00
2023-04-02 04:49:53 -04:00
2023-05-08 10:59:06 +03:00
2022-12-23 23:10:04 +02:00
2022-12-23 23:10:04 +02:00
2023-03-25 16:23:55 -04:00
2022-11-04 23:13:50 +02:00
2023-05-03 04:25:14 -04:00
2023-05-08 07:36:20 -04:00
2023-05-03 04:25:14 -04:00
2022-10-25 05:11:28 -04:00
2023-03-21 15:04:39 +02:00
2023-05-08 07:36:19 -04:00
2023-05-08 07:36:20 -04:00
2022-12-10 21:51:46 +07:00
2023-05-03 04:25:14 -04:00
2023-05-03 04:25:14 -04:00
2023-05-03 04:25:14 -04:00
2022-03-11 12:59:20 -07:00
2023-04-02 18:05:44 +03:00
2022-01-07 00:06:06 -05:00
2022-12-10 21:51:46 +07:00
2023-05-01 19:22:53 -04:00
2023-04-02 05:16:46 -04:00
2023-02-21 09:43:23 -05:00
2023-04-02 04:49:53 -04:00
2023-04-03 17:45:16 +02:00
2022-12-10 21:51:46 +07:00
2023-03-25 16:23:55 -04:00
2023-05-08 07:36:20 -04:00
2023-05-03 04:25:14 -04:00
2023-03-15 01:04:21 -04:00
2023-04-28 13:24:43 -07:00
2023-05-01 19:22:53 -04:00
2023-03-21 08:49:54 +01:00
2023-05-08 07:36:20 -04:00
2022-03-17 11:39:56 -07:00
2023-03-21 08:49:54 +01:00
2023-04-02 04:49:53 -04:00
2023-03-25 16:23:55 -04:00
2023-04-28 16:45:37 -07:00
2023-05-03 04:25:14 -04:00
2023-04-26 19:05:17 -04:00
2021-12-11 00:29:31 +01:00
2023-05-03 04:25:14 -04:00
2023-03-15 01:04:21 -04:00
2023-03-15 01:04:21 -04:00
2023-03-21 08:49:54 +01:00
2022-12-10 21:51:46 +07:00
2023-03-05 02:59:02 -05:00
2023-04-07 20:55:04 -04:00
2023-03-15 01:04:21 -04:00
2023-04-07 01:29:20 +01:00
2023-05-03 04:25:14 -04:00
2023-03-15 01:04:21 -04:00
2022-12-27 21:17:52 +08:00
2023-05-03 04:25:14 -04:00
2023-04-03 18:02:55 +02:00
2023-04-03 18:02:55 +02:00
2023-05-03 04:25:14 -04:00
2022-12-10 21:51:46 +07:00
2023-03-25 16:23:55 -04:00
2022-09-10 01:50:17 +03:00
2022-11-03 14:07:00 +02:00
2023-03-25 16:23:55 -04:00
2023-03-05 02:59:02 -05:00
2022-12-29 11:12:08 +01:00
2023-03-25 16:23:55 -04:00
2023-05-03 04:25:14 -04:00
2023-05-03 04:25:14 -04:00
2023-05-01 19:22:52 -04:00
2023-04-02 04:49:53 -04:00
2022-12-27 21:17:52 +08:00
2022-12-27 21:17:52 +08:00
2023-03-15 01:04:21 -04:00
2023-05-03 04:25:14 -04:00
2022-12-10 21:51:46 +07:00
2023-04-28 16:45:37 -07:00
2023-05-08 07:36:19 -04:00
2023-03-15 01:04:21 -04:00
2022-03-03 18:31:55 -07:00
2023-03-21 08:49:54 +01:00
2023-04-21 16:36:31 -04:00
2022-01-29 18:12:28 +02:00