$NetBSD: patch-xvsmooth.c,v 1.1 2025/04/19 23:14:24 tsutsui Exp $ - Pull fixes from https://gitlab.com/DavidGriffith/xv - https://gitlab.com/DavidGriffith/xv/-/commit/b91710b5 > Fix off-by-one's resulting in dereferencing out-of-bound memory. - https://gitlab.com/DavidGriffith/xv/-/commit/72c80bff > Fix off-by-one in smoothing code and use better interpolation/rounding. --- xvsmooth.c.orig 2025-04-19 20:44:26.706721543 +0000 +++ xvsmooth.c @@ -254,7 +254,7 @@ int is24, swide, shigh, dwide, dhigh; bperpix = (is24) ? 3 : 1; for (j=0; j<=swide; j++) - pixarr[j] = (j*dwide + (15*swide)/16) / swide; + pixarr[j] = ((2 * j + 1 ) * dwide) / ( 2 * swide); cptr = pic824; cptr1 = cptr + swide * bperpix; @@ -369,26 +369,12 @@ int is24, swide, shigh, dwide, dhigh; lastline = linecnt = 0; - for (i=0, clptr=pic824; i<=shigh; i++, clptr+=swide*bperpix) { + for (i=0, clptr=pic824; i