On Wednesday, 18 September 2013 at 09:56:26 UTC, monarch_dodra
wrote:
On Wednesday, 18 September 2013 at 09:09:29 UTC, mrd wrote:
On Wednesday, 18 September 2013 at 09:07:09 UTC, mrd wrote:
Looks like data corruption. Can't help you much without a
full piece of code that *reproduces* the issue (reducing it
helps too).
I will try to do it later. (I tried to copy these functions
in a separate file - the problem is not reproduced.)
this file:
http://pastebin.com/MCm5Yu7K
I had to write "isMsbSet" myself.
Omg, I am send wrong version of the file! Sorry!
Here is it: http://pastebin.com/h950BTyN
Your out contracts also fail, because the body of your function
modifies "value", but then, you use it in your contract.
Is the contract does not uses its own version of arguments?
What is the point of passing earlier changed arguments into
contract block?
I had to change the body to use a copy of the passed in
arguments, to verify them.
From there, it *still* fails, because your unpackVarint is
wrong. You store the result in a size_t, which immediatly
overflows. The irony is you put a comment that says "big sized
type used also for overflow checking". Why not use a T, or
result directly?
Even, then, a problem remains that "data[i] & 0b_0111_1111" is
of type int, causing overflow and sign mismatch for anything
larger than int.max
Above that I'll think later, thanks! (It's amazing that this code
passed all higher-level unit tests for several months.)