Date: Wed, 16 Apr 2003 19:51:38 +0200 (CEST) From: "Daan Vreeken [PA4DAN]" <pa4dan@vitsch.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Danovitsch@vitsch.net Subject: kern/51186: pointer arithmatic error in ugen.c Message-ID: <200304161751.h3GHpcw6002059@vitsch.net> Resent-Message-ID: <200304201450.h3KEoFB5041460@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 51186
>Category: kern
>Synopsis: pointer arithmatic error in ugen.c
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Apr 20 07:50:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Daan Vreeken [PA4DAN]
>Release: FreeBSD 5.0
>Organization:
none
>Environment:
System: FreeBSD 5.0 (and all others I checked)
>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)
>How-To-Repeat:
n/a
>Fix:
--- ugen.c.diff begins here ---
965c965
< sce->cur = sce->ibuf + (sce->limit - sce->cur);
---
> sce->cur = sce->ibuf + (sce->cur - sce->limit);
--- ugen.c.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304161751.h3GHpcw6002059>
