Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail with "index out of bounds" #30

Closed
birktj opened this issue Feb 27, 2019 · 1 comment · Fixed by #32
Closed

Tests fail with "index out of bounds" #30

birktj opened this issue Feb 27, 2019 · 1 comment · Fixed by #32

Comments

@birktj
Copy link
Member

birktj commented Feb 27, 2019

Currently the tests fail with an index out of bounds error, this is probably a bug introduced in #26 that could only be discovered with the tests from #23.

running 1 test
test decoder::stream::test::test_packbits ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/decode_images-564f01fb7ded3313

running 6 tests
test test_gray_u8 ... ok
test test_rgb_u8 ... ok
test test_string_tags ... ok
test test_gray_u16 ... ok
test test_decode_data ... ok
test test_rgb_u16 ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/encode_images-b9c0207f836596cd

running 5 tests
test test_gray_u8_roundtrip ... ok
test test_rgb_u8_roundtrip ... ok
test test_gray_u16_roundtrip ... ok
test encode_decode ... ok
test test_rgb_u16_roundtrip ... FAILED

failures:

---- test_rgb_u16_roundtrip stdout ----
thread 'test_rgb_u16_roundtrip' panicked at 'index out of bounds: the len is 19 but the index is 19', /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/slice/mod.rs:2463:10
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    test_rgb_u16_roundtrip

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test encode_images'
@birktj
Copy link
Member Author

birktj commented Feb 27, 2019

Looking a bit more into this, I found that the bug seems to come from two places, the first place is that in the test I try to read the image twice and that the decoder dosen't stop it from trying to read more strips than the image has.

I will try to come with a patch that fixes this and a few other bugs as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant