[Twinsen] [0.15.13] Buffer overflow in constant combinators

Bugs that are actually features.
Post Reply
BlakkCooper
Inserter
Inserter
Posts: 24
Joined: Mon Jan 26, 2015 3:32 pm
Contact:

[Twinsen] [0.15.13] Buffer overflow in constant combinators

Post by BlakkCooper »

If setting the value of a signal to > 2147483647 or < -2147483647 it creates a buffer overflow. If this is due to the limitations that where put in place because of 32 bit clients in multiplayer worlds it would still be helpful to at least limit the range of numbers entered into the field to prevent confusion.

Edit: i just noticed that this is not a limitation to only constant combinators but to the entire circuit system. I chained several arithmetic combinators together of which each multiplied the signal by 1000 and it does the same thing.

User avatar
MrGrim
Fast Inserter
Fast Inserter
Posts: 232
Joined: Sat Apr 09, 2016 7:58 pm
Contact:

Re: [0.15.13] Buffer overflow in constant combinators

Post by MrGrim »

Combinators have always been based on signed 32 bit ints afaik. This behavior has even been (ab)used in the past for some interesting effects. See: https://www.reddit.com/r/factorio/comme ... erflow_in/

Funnily enough the two uses documented there are no longer needed, but if they were made 64 bit then they would still overflow just with bigger numbers.

BlakkCooper
Inserter
Inserter
Posts: 24
Joined: Mon Jan 26, 2015 3:32 pm
Contact:

Re: [0.15.13] Buffer overflow in constant combinators

Post by BlakkCooper »

MrGrim wrote:Combinators have always been based on signed 32 bit ints afaik. This behavior has even been (ab)used in the past for some interesting effects. See: https://www.reddit.com/r/factorio/comme ... erflow_in/

Funnily enough the two uses documented there are no longer needed, but if they were made 64 bit then they would still overflow just with bigger numbers.
Of course they would overflow at some point but not nearly as early as now. We have stuff like accumulators that hold dozens of GJ of energy but you cannot put that number into the circuit network. The least should be, that when entering numbers in the constant combinator it should prevent you from making any input that would overflow.

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen] [0.15.13] Buffer overflow in constant combinators

Post by Twinsen »

The entire circuit network uses 32 bit signals and works by design like this. I see no point in switching to 64 bit. If anything, the 32bit limitation adds to the fun.

As for the GUI problem, It can even be seen as a feature. When pasting large numbers most of the times it's useful to cut the extra bits instead of clamping to the largest number.

BlakkCooper
Inserter
Inserter
Posts: 24
Joined: Mon Jan 26, 2015 3:32 pm
Contact:

Re: [Twinsen] [0.15.13] Buffer overflow in constant combinators

Post by BlakkCooper »

Twinsen wrote:It's not a bug, it's a feature!
10/10 would buy again.

Post Reply

Return to “Not a bug”