| ... | @@ -497,6 +497,11 @@ pub fn decodeZstandardFrameBlocksArrayList( | ... | @@ -497,6 +497,11 @@ pub fn decodeZstandardFrameBlocksArrayList( |
| 497 | &consumed_count, | 497 | &consumed_count, |
| 498 | frame_context.block_size_max, | 498 | frame_context.block_size_max, |
| 499 | ); | 499 | ); |
| | 500 | if (frame_context.content_size) |size| { |
| | 501 | if (dest.items.len - initial_len > size) { |
| | 502 | return error.BadContentSize; |
| | 503 | } |
| | 504 | } |
| 500 | if (written_size > 0) { | 505 | if (written_size > 0) { |
| 501 | const written_slice = ring_buffer.sliceLast(written_size); | 506 | const written_slice = ring_buffer.sliceLast(written_size); |
| 502 | try dest.appendSlice(written_slice.first); | 507 | try dest.appendSlice(written_slice.first); |
| ... | @@ -508,9 +513,8 @@ pub fn decodeZstandardFrameBlocksArrayList( | ... | @@ -508,9 +513,8 @@ pub fn decodeZstandardFrameBlocksArrayList( |
| 508 | } | 513 | } |
| 509 | if (block_header.last_block) break; | 514 | if (block_header.last_block) break; |
| 510 | } | 515 | } |
| 511 | const added_len = dest.items.len - initial_len; | | |
| 512 | if (frame_context.content_size) |size| { | 516 | if (frame_context.content_size) |size| { |
| 513 | if (added_len != size) { | 517 | if (dest.items.len - initial_len != size) { |
| 514 | return error.BadContentSize; | 518 | return error.BadContentSize; |
| 515 | } | 519 | } |
| 516 | } | 520 | } |