-
Notifications
You must be signed in to change notification settings - Fork 201
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
Ensure that contents
and valid
apply to individual elements (not the whole array)
#1117
Comments
Can you try if this still happens with version 0.9 (snapshot) of the compiler? This might have been fixed as part of #719. |
I tried on the latest version
|
Yeah, I also tried it in the devel Web IDE, and the problem is in this situation: As you can see in the snippet above, the field - id: padding
size: 1
valid:
eq: [0x00] However, the Colorant.prototype._read = function() {
// ...
this.padding = new Array((32 - this.name.length));
for (var i = 0; i < (32 - this.name.length); i++) {
this.padding = this._io.ensureFixedContents([0]);
} In short: But I don't think this BC break is intentional: it's just that the repetitions are often forgotten/overlooked when implementing a new feature in KS, because sometimes their support requires additional hard work (see what needed to be done for the So let's add a test into our test suite and make it work again in the KSC, the |
The current web IDE is failing too. I guess 0.9 has become stable? |
contents
and valid
apply to individual elements (not the whole array)
This change is a prerequisite to solve kaitai-io/kaitai_struct#1117. If the implementation of the `valid` key calls the public accessors to get the value to validate, modifying the `valid` implementation to apply the `valid` constraint to individual elements (as required by kaitai-io/kaitai_struct#1117) causes infinite recursion in the ValidFailInst test in those languages (C++/STL, C#, Go) which use flags to remember whether an instance already has a cached value or not. This is because the public accessor of the instance is then called from the body of the public accessor itself (recursively), and the recursion is infinite due to running the `valid` check before setting the instance flag.
kaitai-struct-compiler -t python .\kaitai_struct_formats\image\icc_4.ksy
can't compare CalcArrayType(BytesLimitType(IntNum(1),None,false,None,None)) and CalcBytesType
The text was updated successfully, but these errors were encountered: