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

Blue Swirl blauwirbel at gmail.com
Fri Aug 21 21:12:47 CEST 2009


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.



More information about the OpenBIOS mailing list