aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmt/parse_float
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-11-01 06:33:40 -0400
committerGitHub <noreply@github.com>2023-11-01 06:33:40 -0400
commit725f765c376dda291d3d5afe5446221a97c189f7 (patch)
treed2c1d77794ba13140aa4a3f0303d56bbec2bd27f /lib/std/fmt/parse_float
parent46062f1c13d8ee9eebf49806660c2271f2acc613 (diff)
parent13b1e10b8f3d8df92417999ed972e5f682c82a46 (diff)
downloadzig-725f765c376dda291d3d5afe5446221a97c189f7.tar.gz
zig-725f765c376dda291d3d5afe5446221a97c189f7.zip
Merge pull request #17802 from jacobly0/read-write-int
mem: fix UB in `readInt`/`writeInt` and delete variants
Diffstat (limited to 'lib/std/fmt/parse_float')
-rw-r--r--lib/std/fmt/parse_float/FloatStream.zig2
-rw-r--r--lib/std/fmt/parse_float/decimal.zig2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/fmt/parse_float/FloatStream.zig b/lib/std/fmt/parse_float/FloatStream.zig
index 803ac65e6d..ad31d15919 100644
--- a/lib/std/fmt/parse_float/FloatStream.zig
+++ b/lib/std/fmt/parse_float/FloatStream.zig
@@ -98,7 +98,7 @@ pub fn skipChars2(self: *FloatStream, c1: u8, c2: u8) void {
}
pub fn readU64Unchecked(self: FloatStream) u64 {
- return std.mem.readIntSliceLittle(u64, self.slice[self.offset..]);
+ return std.mem.readInt(u64, self.slice[self.offset..][0..8], .little);
}
pub fn readU64(self: FloatStream) ?u64 {
diff --git a/lib/std/fmt/parse_float/decimal.zig b/lib/std/fmt/parse_float/decimal.zig
index f8d736a065..f7612cffa3 100644
--- a/lib/std/fmt/parse_float/decimal.zig
+++ b/lib/std/fmt/parse_float/decimal.zig
@@ -260,7 +260,7 @@ pub fn Decimal(comptime T: type) type {
if (!isEightDigits(v)) {
break;
}
- std.mem.writeIntSliceLittle(u64, d.digits[d.num_digits..], v - 0x3030_3030_3030_3030);
+ std.mem.writeInt(u64, d.digits[d.num_digits..][0..8], v - 0x3030_3030_3030_3030, .little);
d.num_digits += 8;
stream.advance(8);
}