Code Monkey home page Code Monkey logo

libcbor-ruby's People

Contributors

grzuy avatar pjk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libcbor-ruby's Issues

`CBOR.decode("\xC6`".b)` raises `CBOR::DecodingError`

Hi,

Apparently I can decode tags 0 to 5, but starting from 6 it returns CBOR::DecodingError. Is this expected?

$ irb
irb(main):001:0> require "libcbor/all"
~/.gem/ruby/2.6.5/gems/libcbor-0.1.0/lib/libcbor.rb:50: warning: constant ::Fixnum is deprecated
=> true
irb(main):002:0> CBOR.decode(CBOR.encode(CBOR::Tag.new(0, "")))
=> #<struct CBOR::Tag value=0, item="">
irb(main):003:0> CBOR.decode(CBOR.encode(CBOR::Tag.new(5, "")))
=> #<struct CBOR::Tag value=5, item="">
irb(main):004:0> CBOR.decode(CBOR.encode(CBOR::Tag.new(6, "")))
Traceback (most recent call last):
        7: from ~/.rubies/ruby-2.6.5/bin/irb:23:in `<main>'
        6: from ~/.rubies/ruby-2.6.5/bin/irb:23:in `load'
        5: from ~/.rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        4: from (irb):4
        3: from ~/.gem/ruby/2.6.5/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `decode'
        2: from ~/.gem/ruby/2.6.5/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `tap'
        1: from ~/.gem/ruby/2.6.5/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `block in decode'
CBOR::DecodingError (CBOR::DecodingError)

Is DecodingError for byte \0x80 expected?

$ irb
irb(main):002:0> require "libcbor/all"
.../.gem/ruby/2.6.0/gems/libcbor-0.1.0/lib/libcbor.rb:50: warning: constant ::Fixnum is deprecated
=> true
irb(main):004:0> CBOR.decode(CBOR.encode("\x7F".b))
=> "\x7F"
irb(main):005:0> CBOR.decode(CBOR.encode("\x80".b))
Traceback (most recent call last):
        7: from ../ruby-2.6.0/bin/irb:23:in `<main>'
        6: from ../ruby-2.6.0/bin/irb:23:in `load'
        5: from ../ruby-2.6.0/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        4: from (irb):5
        3: from ../.gem/ruby/2.6.0/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `decode'
        2: from ../.gem/ruby/2.6.0/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `tap'
        1: from ../.gem/ruby/2.6.0/gems/libcbor-0.1.0/lib/libcbor.rb:65:in `block in decode'
CBOR::DecodingError (CBOR::DecodingError)

`CBOR.decode("A\x00")` returns empty string instead of `"\x00"`

Hi,

Is the following expected?

$ irb
irb(main):001:0> require "libcbor/all"
.gem/ruby/2.6.5/gems/libcbor-0.1.0/lib/libcbor.rb:50: warning: constant ::Fixnum is deprecated
=> true
irb(main):002:0> CBOR.decode("C\x01\x02\x03")
=> "\x01\x02\x03"
irb(main):003:0> CBOR.decode("C\x01\x00\x03")
=> "\x01"
irb(main):004:0> CBOR.decode("A\x00")
=> ""

I mean the last two decode return values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.