On Tue, 21 Jan 2014, 林嘉(程二 福州) wrote:

> Following is a code with bug
> 
> -----------------------------------
> void set_timeout_value(int iParam)
> {
>        int i;
>        byte b[100];
>        i = Geti();
>        if (i > 100 || i < 0){
>                 return ;
>               }               
>        b[i] = iParam; /*  range of I is 0-100,so may overrun array* /
> 
> } 
> -----------------------------------
> Now I write a patch to find it, like this
> 
> @@
> identifier fn, vp;
> identifier I;
> type T;
> expression C;
> @@
> -fn(...,int vp,...)
> -{
> -T I[C];
> -<+...
> -if(vp > C || ...){
> -...
> -}
> -...+>
> -}
> 
> 
> But it doesn’t work, give me a log:
> rule starting on line 1: position variables or mixed modifs interfere with 
> comm_assoc isobool (bool (int vp > int C) || ...)

I will look into it, but you could try putting disable comm_assoc in 
between the initial @@, if you just want to see if your rule is working a 
little bit.

julia


> 
> can anyone tell why, thanks
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
> 
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to