]> Some of my projects - openlase.git/commitdiff
Fix off-by-one out of bounds/memory corruption bug in sobel
authorHector Martin <hector@marcansoft.com>
Sat, 12 Mar 2011 22:41:28 +0000 (23:41 +0100)
committerHector Martin <hector@marcansoft.com>
Sat, 12 Mar 2011 22:41:28 +0000 (23:41 +0100)
libol/trace.c

index 4d27dd5ac03afff3d2816adc184596aeccffc734..aa077ad7336a2f25723db060794655df746aef0d 100644 (file)
@@ -547,7 +547,7 @@ static void find_edges_canny(OLTraceCtx *ctx, uint8_t *src, unsigned int stride)
                px = ctx->sxbuf + y*ctx->aw + 2;
                py = ctx->sybuf + y*ctx->aw + 2;
                pm = ctx->smbuf + y*ctx->aw + 2;
-               for (x = 1; x < (ctx->p.width-2); x++) {
+               for (x = 2; x < (ctx->p.width-2); x++) {
                        uint32_t gm = *pm;
                        if (gm > low_t)  {
                                int16_t gx = *px;