Leonidas-from-XIV / slacko

A neat interface for Slack

Home Page:https://leonidas-from-xiv.github.io/slacko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integer overflow with certain responses on 32-bit platforms

eras opened this issue · comments

In particular, chat_send_message caused issues for me, on Raspberry Pi.

This would be resolved by refraining to use Yojson.Basic-module that does integer conversions always, whereas Yojson.Safe uses Intlit in case of integer overflow.

Thanks for reporting, that's an excellent point! I was only using Yojson.Basic.json for the convenient accessor functions from Yojson.Basic.Util, so I rolled my own Safe.Util now. I'll probably eventually refactor it to avoid exceptions, but for now it should be enough to solve your issue.

Can you please test 77879f9 and check if it solves your issue? I can then push 0.12.1 ASAP.

Doesn't seem to work, though. In fact, now it's broken for 64-bit as well :-).

% _build/src/slack_notify.native -u matomatikki -t xoxb.. '#channel' testing
Your token is xoxb.. , the channel is #channel and the message is 'testing'.
slack-notify: internal error, uncaught exception:
              Slacko.Lookup_failed

The error is a different thing now, it can't parse the JSON from Slack. I've tried adjusting it, but I've seem to have hit an issue with ppx_deriving_yojson: ocaml-ppx/ppx_deriving_yojson#28. Slack has many optional fields in their API, the parser fails when they are not present. Let's see how this unfolds.

I believe this should be fixed now, this time I even ran the code :-). I've reworked the previous fix as well.