Computer Chess Club Archives




Subject: Bug/glitch in Nalimov Code (and in Wilhelm)?

Author: Dieter Buerssner

Date: 00:58:05 05/09/04

I tried to update to newer Nalimov code (with support of the split TBs). Seemed
all easy, but then the program crashed. I had downloaded krppkr and kqppkq to
test. For some reason, I forgot to download the kqqpkq.0.nbb/nbw.emd files.
After the crash, I tried to check integrity with Wilhelm. It did not complain
about the missing files - just said installed/integer.

In the actual Nalimov code, one error condition seems to be missing.

/* Probe TB - lower level (not exportable) function */

static int TB_FASTCALL TbtProbeTable(int iTb, color side, unsigned indChunk,
                                     unsigned indInChunk)
  /* Now read it from the disk */
  FILE     *fp;
  size_t    cb;

/* First, check: is necessary file opened?
   As files are not thread-safe, lock file */
  if (ptbd->m_fSplit) {
    iExtent = indChunk >> (31 - LOG2_TB_CB_CACHE_CHUNK);
    iPhysicalChunk = indChunk - (iExtent << (31 - LOG2_TB_CB_CACHE_CHUNK));
  } else {
    iExtent = 0;
    iPhysicalChunk = indChunk;
  fp = ptbd->m_rgfpFiles[side][iExtent];
  if (NULL == fp) {
/* Not - try to open it */
    pszFileName = ptbd->m_rgpchFileName[side][iExtent];
    if (NULL != pszFileName) {
    [carefully tries to open the file with all sort of error checks]

    [But an else case is missing, and later code assumes, that fp is initialized
correctly. At least this is my understanding of the code. ]
  [Now using fp, which might be NULL]


This page took 0.07 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.