mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
fix ptr out-of-bounds test. Was failing an empty dict.
This commit is contained in:
parent
c7906c3bd4
commit
e1e9a68d8f
1 changed files with 7 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */
|
/* -*- compile-command: "../../scripts/ndkbuild.sh"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright © 2009-2010 by Eric House (xwords@eehouse.org). All
|
* Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights
|
||||||
* rights reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
@ -45,7 +45,7 @@ typedef struct _AndDictionaryCtxt {
|
||||||
} AndDictionaryCtxt;
|
} AndDictionaryCtxt;
|
||||||
|
|
||||||
#define CHECK_PTR(p,c,e) \
|
#define CHECK_PTR(p,c,e) \
|
||||||
if ( ((p)+(c)) >= (e) ) { \
|
if ( ((p)+(c)) > (e) ) { \
|
||||||
XP_LOGF( "%s (line %d); out of bytes", __func__, __LINE__ ); \
|
XP_LOGF( "%s (line %d); out of bytes", __func__, __LINE__ ); \
|
||||||
goto error; \
|
goto error; \
|
||||||
}
|
}
|
||||||
|
@ -568,14 +568,15 @@ makeDict( MPFORMAL JNIEnv *env, JNIUtilCtxt* jniutil, jstring jname,
|
||||||
XP_U32 numEdges;
|
XP_U32 numEdges;
|
||||||
XP_Bool parses = parseDict( anddict, (XP_U8*)anddict->bytes,
|
XP_Bool parses = parseDict( anddict, (XP_U8*)anddict->bytes,
|
||||||
bytesSize, &numEdges );
|
bytesSize, &numEdges );
|
||||||
if ( !parses || (check && !checkSanity( &anddict->super, numEdges ) ) ) {
|
if ( !parses || (check && !checkSanity( &anddict->super,
|
||||||
|
numEdges ) ) ) {
|
||||||
and_dictionary_destroy( (DictionaryCtxt*)anddict );
|
and_dictionary_destroy( (DictionaryCtxt*)anddict );
|
||||||
anddict = NULL;
|
anddict = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (DictionaryCtxt*)anddict;
|
return (DictionaryCtxt*)anddict;
|
||||||
}
|
} /* makeDict */
|
||||||
|
|
||||||
void
|
void
|
||||||
destroyDicts( PlayerDicts* dicts )
|
destroyDicts( PlayerDicts* dicts )
|
||||||
|
|
Loading…
Reference in a new issue