mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Smith.Weight: do not use of indexOfScalar
In larger fuzz tests this can cause the eval branch quota to be exceeded.
This commit is contained in:
@@ -250,9 +250,12 @@ pub const fuzz = struct {
|
||||
}
|
||||
// Reject types that don't have a fixed bitsize (esp. usize)
|
||||
// since they are not gauraunteed to fit in a u64 across targets.
|
||||
if (std.mem.indexOfScalar(type, &.{
|
||||
usize, c_char, c_ushort, c_uint, c_ulong, c_ulonglong,
|
||||
}, T) != null) {
|
||||
//
|
||||
// std.mem.indexOfScalar is not used to avoid backward branches
|
||||
// and preserve the eval branch quota.
|
||||
if (T == usize or T == c_char or T == c_ushort or
|
||||
T == c_uint or T == c_ulong or T == c_ulonglong)
|
||||
{
|
||||
@compileError("type does not have a fixed bitsize: " ++ @typeName(T));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user