-
Notifications
You must be signed in to change notification settings - Fork 26
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
Invalid byte sequence crashes ksdump 0.7 #61
Comments
@ross-spencer, thanks for reporting this! It looks like in this specific example, the caveat is with the fact that Ruby UTF-8 parsing is quite "forgiving" in terms of getting byte sequences which are not valid UTF-8 characters as strings, e.g. [.] magic = "\xBB\r\neyeglass\u001A\n\xAB" This backfires when trying to use standard YAML or JSON libraries trying to dump these, though, as they give up. To be honest, I'm not sure what behavior we'd want in this case. Probably reporting a more precise error should be a good idea (e.g. down to a specific attribute path). Showing that string is not a valid UTF-8 in ksv might be a good idea too, but then ksv is supposed to be "all forgiving", and, it actually is right now. The simplest fix on .ksy side would be removing axis_right_left:
- 130
- 80
base_right_left:
- 0.0
- 0.0
cylinder_right_left:
- -0.25
- -1.0
datetime: '2012-11-08T12:37:50'
distance_acuity_right_left:
- 0.6600000262260437
- 0.5
endianness: 1
eof: BB 65 6F 66
format_expansion_room: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00
magic: BB 0D 0A 65 79 65 67 6C 61 73 73 1A 0A AB
near_acuity_right_left:
- 12
- 12
next_checkup_years: 1.0
observation9: "Patient's eyesight needs correction. History of diabetes in family
but indicators found. Standard checkup interval recommended.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
prism_right_left:
- 0.0
- 0.0
purpose: "Distance and Close Work.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
sphere_right_left:
- -3.3499999046325684
- 0.5
version: '01' |
From ksdump's side, I can propose several solutions. While doing recursive traversal, check for string validity (e.g.
Thoughts? |
@GreyCat thanks for that. I see where my assumptions were wrong now. I took your approach to remove the offending ksdump has been useful for debugging here, I'll reflect on that in my writeup. From my perspective, out of the potential changes, then:
Would be a useful starting place, as for string substitution, or dumping raw bytes, then they seem nice options, but providing they didn't obscure the user error in any way, i.e. it was still clear that the |
The added granularity allows us to correctly decode the BOF and EOF sequences in ksdump, annotating each part of the objects that form those. NB. the description could be more detailed than initially committed here. Related to: kaitai-io/kaitai_struct_visualizer#61
I an seeing ksdump crash with the following:
Example file.
Example ksy.
Via: https://github.com/ross-spencer/eyeglass/tree/main
I'm not clear on if this is a user error, or if there's a newer version of ksdump I should be looking at?
The text was updated successfully, but these errors were encountered: