Computer Chess Club Archives


Search

Terms

Messages

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

Author: Eugene Nalimov

Date: 19:23:47 05/09/04

Go up one level in this thread


On May 09, 2004 at 03:58:05, Dieter Buerssner wrote:

>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 */
>  Lock(ptbd->m_rglockFiles[side]);
>  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]
>
>Regards,
>Dieter

Add "else goto ERROR_LABEL;". I believe that is enough.

Will add it to the new code I Bob will release soon.

Thanks,
Eugene



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.