| ... | @@ -380,7 +380,7 @@ pub const FrameContext = struct { | ... | @@ -380,7 +380,7 @@ pub const FrameContext = struct { |
| 380 | /// - `error.WindowSizeUnknown` if the frame does not have a valid window | 380 | /// - `error.WindowSizeUnknown` if the frame does not have a valid window |
| 381 | /// size | 381 | /// size |
| 382 | /// - `error.WindowTooLarge` if the window size is larger than | 382 | /// - `error.WindowTooLarge` if the window size is larger than |
| 383 | /// `window_size_max` | 383 | /// `window_size_max` or `std.math.intMax(usize)` |
| 384 | /// - `error.ContentSizeTooLarge` if the frame header indicates a content | 384 | /// - `error.ContentSizeTooLarge` if the frame header indicates a content |
| 385 | /// size larger than `std.math.maxInt(usize)` | 385 | /// size larger than `std.math.maxInt(usize)` |
| 386 | pub fn init( | 386 | pub fn init( |
| ... | @@ -395,7 +395,7 @@ pub const FrameContext = struct { | ... | @@ -395,7 +395,7 @@ pub const FrameContext = struct { |
| 395 | const window_size = if (window_size_raw > window_size_max) | 395 | const window_size = if (window_size_raw > window_size_max) |
| 396 | return error.WindowTooLarge | 396 | return error.WindowTooLarge |
| 397 | else | 397 | else |
| 398 | @as(usize, @intCast(window_size_raw)); | 398 | std.math.cast(usize, window_size_raw) orelse return error.WindowTooLarge; |
| 399 | | 399 | |
| 400 | const should_compute_checksum = | 400 | const should_compute_checksum = |
| 401 | frame_header.descriptor.content_checksum_flag and verify_checksum; | 401 | frame_header.descriptor.content_checksum_flag and verify_checksum; |