Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [BUG] Printing a large number makes both AGKS and AGKC interpreter crash without error message.

Author
Message
Cybermind
Valued Member
17
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 8th Jul 2020 12:40
This code makes both Windows AGKS and AGKC interpreter crash without any error messages. I was just experimenting with building a float manually from a bit pattern and ran into this little bug. Removing the print command makes the program run fine.

13/0
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 8th Jul 2020 13:22 Edited at: 8th Jul 2020 14:11
Yep its a bug.

Internally, AppGameKit uses a 20 character buffer to put the text version of a number into, before printing it.

If the float number has more digits then that, then it overuns that buffer and starts writing into memory after it. Theres no 32bit integer number with more than 20 digits so they arent a problem.

However, floats can have way more digits then that... basically trying to print ANY value greater than around pow(2,64) will overflow the character buffer and potentially cause a crash.

Might be worth adding this as a bug to github ....its a really easy fix in the teir 2 libs and ive fixed it in mine.

Login to post a reply

Server time is: 2020-08-04 03:57:34
Your offset time is: 2020-08-04 03:57:34