Author Topic: Old SCI0 Template Save Bug  (Read 13128 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Re: Old SCI0 Template Save Bug
« Reply #30 on: July 17, 2020, 12:15:39 AM »
I think the thread took a turn and stopped being about the save bug  :P
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Old SCI0 Template Save Bug
« Reply #31 on: July 18, 2020, 02:37:50 PM »
I found the bug! It is a buffer overflow in the script code.
We have this line:
Code: [Select]
(method (doit strDescription &tmp temp0 temp1 temp2 temp3 [temp4 360] [temp365 20] [temp386 20])
Look closely at the temp4 variable (which contains the description strings and comes just before the index numbers). It is sized as 360 (20*18 words), but this is not quite enough. Eric's authentic file has this define:
Code: [Select]
(define BUFFERSIZE 361) ;(define BUFFERSIZE (+ (* MAXGAMES COMMENTBUFF) 1))If you change the size of that temp4 array to be just a bit larger (361 words), you'll get the intended result.

Offline Doan Sephim

Re: Old SCI0 Template Save Bug
« Reply #32 on: July 18, 2020, 03:07:37 PM »
Fantastic! I did the suggested change and it seems to work perfectly!

Awesome catch! I wouldn't have seen that in a million years.

Quick question, is there any potential unintended consequences or is this a fairly clean fix. I get that it was an overflow issue, but my comprehension of how and why is not so good.

Offline Kawa

Re: Old SCI0 Template Save Bug
« Reply #33 on: July 18, 2020, 03:14:38 PM »
It's a clean fix and holy shit that's a sneaky one haha

Offline lskovlun

Re: Old SCI0 Template Save Bug
« Reply #34 on: July 18, 2020, 03:35:06 PM »
It's a clean fix and holy shit that's a sneaky one haha
It's sneaky and goes right back to SCI Studio. That means this is handwritten, not decompiled code. It was rewritten from an ASM block.
« Last Edit: July 18, 2020, 03:38:21 PM by lskovlun »

Offline troflip

Re: Old SCI0 Template Save Bug
« Reply #35 on: July 18, 2020, 04:45:24 PM »
Wow! You should feel good about finding that one!  :)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline EricOakford

Re: Old SCI0 Template Save Bug
« Reply #36 on: July 18, 2020, 06:13:31 PM »
It's a clean fix and holy shit that's a sneaky one haha
It's sneaky and goes right back to SCI Studio. That means this is handwritten, not decompiled code. It was rewritten from an ASM block.

Naturally, when you only have disassembled code for reference, mistakes can be made. With original source for reference, these can be discovered and fixed.
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline Doan Sephim

Re: Old SCI0 Template Save Bug
« Reply #37 on: July 18, 2020, 06:20:46 PM »
You guys are awesome! Thanks for looking into this for me. I'm looking forward to using SCI01 moving forward, so I'm sure these problems will be a thing of the past.

Offline lskovlun

Re: Old SCI0 Template Save Bug
« Reply #38 on: July 19, 2020, 11:51:51 AM »
I have to thank Phil for coming up with a different way to test this. It was really the discrepancy between the two approaches that led me on the right track.

Offline MusicallyInspired

Re: Old SCI0 Template Save Bug
« Reply #39 on: July 19, 2020, 04:21:36 PM »
Awesome!!
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.041 seconds with 19 queries.