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

C++: Use unsigned size type for loop index #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johnbeard
Copy link

This avoids a wrong sign conversion when the loop expression casts to a negative signed int.

Fixes: kaitai-io/kaitai_struct#1220


I did intend to add a test for this based on the reproducing case in the linked issue, but I could not figure out how to actually run the tests.

I tried build-tests cpp_stl in the tests repo, but it errored out with complaints about Julia(?):

[error] /home/john/src/kaitai_struct/tests/translator/src/main/scala/io/kaitai/struct/testtranslator/specgenerators/JuliaSG.scala:6:8: object JuliaCompiler is not a member of package io.kaitai.struct.languages
[error] did you mean JavaCompiler or LuaCompiler?
[error] import _root_.io.kaitai.struct.languages.JuliaCompiler

How can I build/run the tests? I'll be more than happy to add a test if I know how!

This avoids a wrong sign conversion when the loop expression casts
to a negative signed int.

Fixes: kaitai-io/kaitai_struct#1220
@johnbeard
Copy link
Author

I figured out adding a test: kaitai-io/kaitai_struct_tests#133

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 this pull request may close these issues.

C++: wrong integer conversion in loop index
1 participant