mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Make this more careful
This commit is contained in:
@@ -1723,7 +1723,7 @@ pub fn copyLatin1IntoUTF16(comptime Buffer: type, buf_: Buffer, comptime Type: t
|
||||
var buf = buf_;
|
||||
var latin1 = latin1_;
|
||||
while (buf.len > 0 and latin1.len > 0) {
|
||||
const to_write = strings.firstNonASCII(latin1) orelse @truncate(u32, latin1.len);
|
||||
const to_write = strings.firstNonASCII(latin1) orelse @truncate(u32, @min(latin1.len, buf.len));
|
||||
if (comptime std.meta.alignment(Buffer) != @alignOf(u16)) {
|
||||
strings.copyU8IntoU16WithAlignment(std.meta.alignment(Buffer), buf, latin1[0..to_write]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user