kern/51074: pointer arithmatic error in ugen.c

Daan Vreeken [PA4DAN] Danovitsch at Vitsch.net
Thu Apr 17 00:40:15 PDT 2003


Hi,

I have just submitted ker/51074: pointer arithmatic error in ugen.c
( http://www.FreeBSD.org/cgi/query-pr.cgi?pr=kern%2F51074 )
with this description :

I believe there is a pointer arithmatic error in line 965 of ugen.c .
The entire piece of code reads :

961:    /* throw away oldest input if the buffer is full */
962:    if(sce->fill < sce->cur && sce->cur <= sce->fill + count) {
963:            sce->cur += count;
964:            if(sce->cur >= sce->limit)
965:                    sce->cur = sce->ibuf + (sce->limit - sce->cur);
966:            DPRINTFN(5, ("ugen_isoc_rintr: throwing away %d bytes\n",
967:                        count));
978:    }

count gets added to sce->cur .
if the pointer equals/exceeds the end of the buffer, we move it to the
beginnen of the buffer (plus the X bytes it was past the end).

If sce->cur exceeds sce->limit, (sce->cur - sce->limit) would be a negative
value. (resulting in a sce->cur pointer sitting X bytes before the beginning
of the buffer)
-- end --

Could someone please check if I'm correct and apply the patch?

ps: thanks to some mailing-weirdness the pr is marked confidential, which it 
shouldn't have been.. :S

thanks,
Daan


More information about the freebsd-hackers mailing list