[OpenBIOS] [patch 6/6] Prevent dereferencing page zero and complain about invalid handles

Igor Kovalenko igor.v.kovalenko at gmail.com
Fri Aug 21 22:23:58 CEST 2009


On Fri, Aug 21, 2009 at 11:12 PM, Blue Swirl<blauwirbel at gmail.com> wrote:
> On Fri, Aug 21, 2009 at 12:16 AM, Igor
> Kovalenko<igor.v.kovalenko at gmail.com> wrote:
>> Index: openbios-devel/forth/device/package.fs
>> ===================================================================
>> --- openbios-devel.orig/forth/device/package.fs
>> +++ openbios-devel/forth/device/package.fs
>> @@ -59,10 +59,15 @@
>>
>>  : find-method ( method-str method-len phandle -- false | xt true )
>>   \ should we search the private wordlist too? I don't think so...
>> -  >dn.methods @ find-wordlist if
>> -    true
>> +  ?dup if
>> +    >dn.methods @ find-wordlist if
>> +      true
>> +    else
>> +      2drop false
>> +    then
>>   else
>> -    2drop false
>> +      cr ." find-method: " type ."  : NULL phandle" cr
>> +      false
>>   then
>>  ;
>>
>> @@ -75,10 +80,18 @@
>>
>>
>>  : $call-method  ( ... method-str method-len ihandle -- ??? )
>> -  dup >r >in.device-node @ find-method if
>> -    r> call-package
>> +  \ check if my-self exists; if not, there is nothing to call from
>> +
>> +  ?dup if
>> +    dup >r >in.device-node @ find-method if
>> +      r> call-package
>> +    else
>> +      cr ." $call-method: instance method not found" cr
>> +      -821 throw
>> +    then
>>   else
>> -    -21 throw
>> +    cr ." $call-method: " type ."  : NULL ihandle" cr
>> +    -f21 throw
>>   then
>>  ;
>
> Can we find out the caller in these cases? The error messages are not
> very useful to the user. They also happen on Sparc32.
>

Eventually all callers would be covered, it takes time to trace
forth code calls to origins. I think it is better to have extra messages
in place while doing so.

In fact for me it takes so much extra time that I'm inclined to reimplement
some forth code as C equivalents to keep debugging manageable.

-- 
Kind regards,
Igor V. Kovalenko



More information about the OpenBIOS mailing list