Skip to content

Commit 2b0ed38

Browse files
authored
Merge pull request #126 from lovasoa/fix-125
Fix invalid line stride computation causing OOB array accesses
2 parents a41aef8 + 8c53ff6 commit 2b0ed38

File tree

9 files changed

+7
-4
lines changed

9 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## Unreleased
66

7+
## v0.1.18 (2019-12-10)
8+
- Fix two bugs causing panics introduced in 0.1.17.
9+
710
## v0.1.17 (2019-12-08)
811
- Minimum supported rust version changed to 1.34
912
- Fix clippy::into_iter_on_array warning

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jpeg-decoder"
3-
version = "0.1.17"
3+
version = "0.1.18"
44
authors = ["Ulf Nilsson <kaksmet@gmail.com>"]
55
description = "JPEG decoder"
66
documentation = "https://docs.rs/jpeg-decoder"

src/decoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,10 @@ fn compute_image(components: &[Component],
785785
let height = component.size.height as usize;
786786

787787
let mut buffer = vec![0u8; width * height];
788-
let line_stride = width * component.dct_scale;
788+
let line_stride = component.block_size.width as usize * component.dct_scale;
789789

790-
for y in 0 .. width {
791-
for x in 0 .. height {
790+
for y in 0 .. height {
791+
for x in 0 .. width {
792792
buffer[y * width + x] = data[0][y * line_stride + x];
793793
}
794794
}
1.36 KB
Loading
1.19 KB
Loading
1.45 KB
Loading
1.55 KB
Loading
331 Bytes
Loading
325 Bytes
Loading

0 commit comments

Comments
 (0)