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

using cbor2diag on damaged data #9

Open
mcr opened this issue Jun 21, 2018 · 3 comments
Open

using cbor2diag on damaged data #9

mcr opened this issue Jun 21, 2018 · 3 comments

Comments

@mcr
Copy link

mcr commented Jun 21, 2018

{{{
dooku-projects/pandora/fountain mcr 10006 %cbor2diag.rb tmp/ff1.cbor
/usr/local/rvm/gems/ruby-2.3.0/gems/cbor-diag-0.2.5/lib/cbor-pure.rb:193:in `take': Out of bytes to decode: 290 (CBOR::OutOfBytesError)
}}}

So something has truncated my CBOR, pretty sad for me, and I'm debugging it.
I wonder if there is someway that cbor2diag could show me what it does have, and at which point the shortage of data has occured?

@cabo
Copy link
Owner

cabo commented Jun 21, 2018

How about

dd if=/dev/zero bs=4711 count=1 >> tmp/ff1.cbor
cborseq2yaml.rb tmp/ff1.cbor

OK, this needs some work on the user interface side, but it does give you some hints what's in there.

@cabo
Copy link
Owner

cabo commented Jun 21, 2018

Slightly cleaned up:

(cat tmp/ff1.cbor; ruby -e 'print 247.chr*333') | cborseq2yaml.rb

(Probably redirect that somewhere so you can more easily ignore the junk at the end.)

@cabo
Copy link
Owner

cabo commented Jun 21, 2018

Just pushed 0.5.5 with a "cborleader2diag.rb" so you have less junk to look at:

(cat tmp/ff1.cbor; ruby -e 'print 247.chr*333') | cborleader2diag.rb

I may have to consolidate all these little tool-lets at some point...

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

No branches or pull requests

2 participants