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

fix/flac: Actually print relevant incorrect type #49

Merged
merged 2 commits into from
Jan 1, 2022

Conversation

karlek
Copy link
Contributor

@karlek karlek commented Dec 31, 2021

si will always be (*meta.StreamInfo), the relevant type is
block.Header.Type which implements Stringer

`si` will always be `(*meta.StreamInfo)`, the relevant type is
`block.Header.Type` which implements `Stringer`
Copy link
Member

@mewmew mewmew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

The si variable will indeed always be of type *meta.StreamInfo due to the type assertion. What we intend to print is the type of block.Body if ok is false.

flac.go Outdated Show resolved Hide resolved
Co-authored-by: Robin <[email protected]>
@karlek
Copy link
Contributor Author

karlek commented Jan 1, 2022

I agree with your suggestion, it will highlight which data structure was assigned instead of just a static string type.
Free to merge!

Copy link
Member

@mewmew mewmew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Gott nytt år bror! ❤️

@mewmew mewmew merged commit 59ff7d9 into master Jan 1, 2022
@wader
Copy link

wader commented Jan 1, 2022

Hey @karlek @mewmew this reminded me that i should thank you for your flac implementation which was very good to have as an alternative implementation in addition to the xiph one when learning about FLAC. Tack! also wanted to mention that my tool fq has quite good FLAC support partially because of this, it might be handy if need to investigate something FLAC-related.

Gott nytt!

@mewmew
Copy link
Member

mewmew commented Jan 1, 2022

@wader,

Hey @karlek @mewmew this reminded me that i should thank you for your flac implementation which was very good to have as an alternative implementation in addition to the xiph one when learning about FLAC. Tack! also wanted to mention that my tool fq has quite good FLAC support partially because of this, it might be handy if need to investigate something FLAC-related.

Glad to hear! My brother and I had a lot of fun implementing the Go FLAC library, and it's always fun to hear it has been useful for others :)

fq looks like a really cool tool! I love using jq, and having similar capabilities for binary formats it great!

Gott nytt!

Gott nytt!

@wader
Copy link

wader commented Jan 1, 2022

fq looks like a really cool tool! I love using jq, and having similar capabilities for binary formats it great!

Also fell in love with jq some years ago and i also spent a lot of time digging in binary data... then a day one year ago or so i though: what if? :)

@mewmew
Copy link
Member

mewmew commented Jan 1, 2022

Also fell in love with jq some years ago and i also spent a lot of time digging in binary data... then a day one year ago or so i though: what if? :)

That's awesome! What kind of binary project do you play with? My brother and I also enjoy flipping bits <3

Some assorted reversing projects at: https://github.com/mewrev

The most useful of which may be tools/cmd/type2kaitai (and enum2kaitai) which parses Go source code to produce corresponding Kaitai struct definitions of Go type and enum definitions.

@wader
Copy link

wader commented Jan 1, 2022

That's awesome! What kind of binary project do you play with? My brother and I also enjoy flipping bits <3

Good to hear! hobby and interest-wise it is mostly just to understand how all kinds of things work. At work i do lot of media related things, debug broken files, query and aggregate things about files, verify test things during development etc. That is why there is so many media decoders at the moment :) Also i really like programming languages so working the mix of go/jq has been very interesting, what should be in go, what in jq? how should they interact? also study and help improve gojq has been fun!

What sort of stuff are you two up to?

Some assorted reversing projects at: https://github.com/mewrev

The most useful of which may be tools/cmd/type2kaitai (and enum2kaitai) which parses Go source code to produce corresponding Kaitai struct definitions of Go type and enum definitions.

Oj lots of interesting stuff there. Actually just a few days ago I started looking into how to add a kaitai support, been on the todo list for a while. My plan is to do something runtime interpreted to support users providing ksy-files on the command line etc. Good/bad idea?

Also PE-decoder is on the wishlist :)

@mewmew
Copy link
Member

mewmew commented Jan 2, 2022

Oj lots of interesting stuff there. Actually just a few days ago I started looking into how to add a kaitai support, been on the todo list for a while. My plan is to do something runtime interpreted to support users providing ksy-files on the command line etc. Good/bad idea?

If you haven't looked at the Kaitai web IDE yet, definitely check it out!

https://ide.kaitai.io/

You can do live analysis of binary files, and even modify the ksy definitions as you go. Adding some kind of runtime interpreter for ksy-files may be a fun idea at least, if useful, that time will tell ; ) Definitely take inspiration from the Kaitai IDE!

Also PE-decoder is on the wishlist :)

Heh, yeah. Fair warning, mewrev/pe is in a perpetual incomplete state, so if you are looking for something stable, look elsewhere. If you just want to play around, then definitely take a look! :)

@wader
Copy link

wader commented Jan 4, 2022

Oj lots of interesting stuff there. Actually just a few days ago I started looking into how to add a kaitai support, been on the todo list for a while. My plan is to do something runtime interpreted to support users providing ksy-files on the command line etc. Good/bad idea?

If you haven't looked at the Kaitai web IDE yet, definitely check it out!

https://ide.kaitai.io/

You can do live analysis of binary files, and even modify the ksy definitions as you go. Adding some kind of runtime interpreter for ksy-files may be a fun idea at least, if useful, that time will tell ; ) Definitely take inspiration from the Kaitai IDE!

Yes played around a bit with it, very useful! hope i have time to build something similar for fq at some point. Would be nice to be able to have multiple repl "sessions" and also display decode tree like that or visualize in different ways, have been thinking how to visualize "overlapping" fields somehow, use depth or color blending somehow?

To do kaitai at runtime i think i have to more or less implement my own parser/executor somehow. Can't really use the official scala compiler or https://github.com/cugu/kaitaigo as they seem to transpile to go. But i think they will be useful to study.

Heh, yeah. Fair warning, mewrev/pe is in a perpetual incomplete state, so if you are looking for something stable, look elsewhere. If you just want to play around, then definitely take a look! :)

Sure will! it really helps to have multiple implementations to look at when learning things like this.

@mewmew mewmew deleted the incorrect-first-metadata-block-better-error branch October 24, 2023 09:30
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.

3 participants