cast icon indicating copy to clipboard operation
cast copied to clipboard

fix ToUint64E and ToUint64 overflow, e.g. "18446744073709551615"(math.MaxUint64)

Open morrisxyang opened this issue 1 year ago • 8 comments

cast.ToUint64E("18446744073709551615") // math.MaxUint64 will get err about value out of range. For ToUint64E, using strconv.ParseUint instead of strconv.ParseInt.

morrisxyang avatar Mar 06 '23 09:03 morrisxyang

@sagikazarmark

morrisxyang avatar Mar 06 '23 09:03 morrisxyang

For code consistency, other uint cast methods are also changed to use strconv.ParseUint. tests look good.

morrisxyang avatar Mar 07 '23 02:03 morrisxyang

@Imatvoid you need to cool off with these "mentions" (and emails).

bep avatar Mar 07 '23 08:03 bep

ok

morrisxyang avatar Mar 07 '23 14:03 morrisxyang

I saw this #140, but seemingly changing strconv.ParseUInt to strconv.ParseInt in the ToUint64E method led to an overflow problem. Or is there something I understand wrong? I’m eager to receive feedback.

morrisxyang avatar Mar 08 '23 06:03 morrisxyang

The problem is on our radar, but it's a little bit more complicated than that.

We will provide a solution. Until then, using a fork should be relatively easy in Go.

sagikazarmark avatar Mar 08 '23 07:03 sagikazarmark

The problem is on our radar, but it's a little bit more complicated than that.

We will provide a solution. Until then, using a fork should be relatively easy in Go.

Thank you for your reply, actually, I'm interested in the "a little bit more complicated" problem. I will pay attention to the progress and try to learn something. It would be better if I could help.

morrisxyang avatar Mar 08 '23 07:03 morrisxyang

The problem is on our radar, but it's a little bit more complicated than that.

We will provide a solution. Until then, using a fork should be relatively easy in Go.

Hi @sagikazarmark, any updates with this one?

rickywei avatar Aug 04 '23 01:08 rickywei