lib/math+encoding: restore Hare loud preconditions (F-Q)
Three lib functions had lost their Hare loud-abort preconditions, so an out-of-domain argument silently returned garbage instead of aborting: random.u32n / random.u64n assert(n != 0) ref/hare/math/random/random.ha:26,42 base64.decodedsize assert(sz%4 == 0) ref/hare/encoding/base64/base64.ha:597 Source-bundled lib change, identical on both stages (byte-id neutral). 989_libprecond_abort pins each precondition: n=0 / sz%4!=0 abort (rc!=0), valid args return 0, run on cstage and wwstage.
This commit is contained in:
@@ -413,5 +413,6 @@ export fn encodedsize(sz: i32) i32 = {
|
||||
// length is up to 2 bytes shorter, depending on padding). `sz` must be a
|
||||
// multiple of 4. ref/hare/encoding/base64/base64.ha:596-599.
|
||||
export fn decodedsize(sz: i32) i32 = {
|
||||
assert(sz % 4i32 == 0i32); // ref/hare/encoding/base64/base64.ha:597
|
||||
return sz / 4 * 3;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user