Coder Social home page Coder Social logo

eddy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jtippett

eddy's Issues

Crash on subtly invalid from_bin input

Hey there, great library! I did notice one issue. Due to an invalid encoding setting in one system, I was passing jumbled keys around, and eddy crashed hard:

iex(5)> b64_vk = "AjXhpbLYvvzkWnNjSWocHAtWS/eokEsCkVTSm08gLfKL"
"AjXhpbLYvvzkWnNjSWocHAtWS/eokEsCkVTSm08gLfKL"
iex(6)> {:ok, bin} = Base.decode64 b64_vk
{:ok,
 <<2, 53, 225, 165, 178, 216, 190, 252, 228, 90, 115, 99, 73, 106, 28, 28, 11,
   86, 75, 247, 168, 144, 75, 2, 145, 84, 210, 155, 79, 32, 45, 242, 139>>}
iex(7)> Eddy.PubKey.from_bin bin
** (FunctionClauseError) no function clause matching in Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1    
    
    The following arguments were given to Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1:
    
        # 1
        <<2, 53, 225, 165, 178, 216, 190, 252, 228, 90, 115, 99, 73, 106, 28, 28, 11,
          86, 75, 247, 168, 144, 75, 2, 145, 84, 210, 155, 79, 32, 45, 242, 139>>
    
    Attempted function clauses (showing 1 out of 1):
    
        defp normalize_y(<<bytes::binary-size(31), last>>)
    
    (eddy 1.0.0) lib/eddy/point.ex:120: Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1
    (eddy 1.0.0) lib/eddy/point.ex:99: Eddy.Serializable.Encoder.Eddy.Point.parse/2
    (eddy 1.0.0) lib/eddy/pub_key.ex:27: Eddy.Serializable.Encoder.Eddy.PubKey.parse/2
    (eddy 1.0.0) lib/eddy/pub_key.ex:24: Eddy.PubKey.from_bin/2
    iex:7: (file)

Probably because the key was the right "shape" but due to the aforementioned settings issue, it evidently made it through whatever checks were in place. It's no issue as I am further validating the data and also placing the from_bin in a try/catch but since it was a pretty hard crash, thought I'd let you know.

Thanks again for the great library, a joy to work with!

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.