Alavan avatar

Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow

alavan

Published: 04 Sept 2018 › Updated: 04 Sept 2018Possible fix for:  Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow

Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow

So I saw this story:

Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow

And I came up with something. Let me know if I'm missing something fundamental here.

Maybe I'm missing something fundamental here, but if they didn't want to upgrade the systems to 64-bit, couldn't you do the following:

When the counter reaches max-int, increment a new counter (let's name it bigCounter), and reset the counter to zero.
When checking the difference in time from a timestamp after the counter-reset (meaning the timestamp for bigCounter is different now), check the difference between the timestamp's counter value and maxint, and then:

if (maxint - counter > difference)
      return counter + difference
else 
    increment the returned bigCounter difference 
    return maxint - difference

Then convert the returned value (counterDiff and bigCounterDiff) in seconds and 248-day increments back to days/hours/minutes (presumably you'd also have a function that returns the difference between the timestamp's bigCounter value too) to check against critical functions.

I realize I'm simplifying here, and it's probably several million dollars to fix, using the above, what could be basically fixed by upgrading to 64-bit architecture, which probably needs to be done anyway.

Thoughts

Leave Possible fix for: Reboot Your Dreamliner Every 248 Days To Avoid Integer Overflow to:

Written by

Interested in: Gaming, Software Development, Cryptocurrency, Cars, Bikes, Outdoors

Read more #programming posts


Best Posts From Alavan

We have not curated any of alavan's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Alavan