| ... | ... | @@ -259,9 +259,9 @@ fn readBlock(input: *Reader, allocating: *Writer.Allocating) !void { |
| 259 | 259 | |
| 260 | 260 | // Block Padding |
| 261 | 261 | const block_counter = header_size + packed_bytes_read; |
| 262 | | const padding = (4 - (block_counter % 4)) % 4; |
| 263 | | for (0..padding) |_| { |
| 264 | | if (try input.takeByte() != 0) return error.CorruptInput; |
| 262 | const padding = try input.take(@intCast((4 - (block_counter % 4)) % 4)); |
| 263 | for (padding) |byte| { |
| 264 | if (byte != 0) return error.CorruptInput; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| ... | ... | @@ -279,14 +279,13 @@ fn finish(d: *Decompress) !void { |
| 279 | 279 | if (record_count != d.block_count) |
| 280 | 280 | return error.CorruptInput; |
| 281 | 281 | |
| 282 | | for (0..record_count) |_| { |
| 282 | for (0..@intCast(record_count)) |_| { |
| 283 | 283 | // TODO: validate records |
| 284 | 284 | _ = try countLeb128(input, u64, &input_counter, &checksum); |
| 285 | 285 | _ = try countLeb128(input, u64, &input_counter, &checksum); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | | const padding_len = (4 - (input_counter % 4)) % 4; |
| 289 | | const padding = try input.take(padding_len); |
| 288 | const padding = try input.take(@intCast((4 - (input_counter % 4)) % 4)); |
| 290 | 289 | for (padding) |byte| { |
| 291 | 290 | if (byte != 0) return error.CorruptInput; |
| 292 | 291 | } |