[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] patch: malloc(0) and array bound violation
From: |
Gunnar Farnebäck |
Subject: |
Re: [gnugo-devel] patch: malloc(0) and array bound violation |
Date: |
Thu, 24 Jun 2004 00:12:01 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
Teun wrote:
> The second part is the (temporary) addition of an assertion in optics.c.
> There
> is an array bound violation here detect by compiling with array bound
> checking enabled.
> The assertion is triggered in owl.tst for test 3 when running gnugo
> --mode gtp < owl.tst.
That code (original, not patch) looks odd:
> for (k = 0; k < best_vp->num_defenses && k < MAX_EYE_ATTACKS; k++)
> vital[pos].defense_points[k] = best_vp->defenses[k];
> - for (k = 0; k < best_vp->num_attacks; k++)
Unless Arend was trying something unexpectedly clever it's probably
just a mistake that the second loop doesn't have the k <
MAX_EYE_ATTACKS condition like the first loop.
/Gunnar