summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a7516bc)
The maximum length of a verb is now limited to 120 (which can be changed in the source code). Previously very long verbs would crash the compiler. This change is being pulled from upstream based on commit
560f49f dated Aug 16 2017. Also update the version number and the copyright years for the modified files based on this change. These changes are similiarly relicensed to GPL per Section 4(c)(ii) of the Artistic License 2.0.
/* ------------------------------------------------------------------------- */
/* Header file for Inform: Z-machine ("Infocom" format) compiler */
/* */
/* ------------------------------------------------------------------------- */
/* Header file for Inform: Z-machine ("Infocom" format) compiler */
/* */
-/* Copyright (c) Graham Nelson 1993 - 2016 */
+/* Copyright (c) Graham Nelson 1993 - 2017 */
/* */
/* This file is part of Inform. */
/* */
/* */
/* This file is part of Inform. */
/* */
/* */
/* ------------------------------------------------------------------------- */
/* */
/* ------------------------------------------------------------------------- */
-#define RELEASE_DATE "1 Oct 2016"
+#define RELEASE_DATE "16 Aug 2017"
#define RELEASE_NUMBER 1634
#define GLULX_RELEASE_NUMBER 38
#define MODULE_VERSION_NUMBER 1
#define RELEASE_NUMBER 1634
#define GLULX_RELEASE_NUMBER 38
#define MODULE_VERSION_NUMBER 1
#define MAX_DICT_WORD_SIZE 40
#define MAX_DICT_WORD_BYTES (40*4)
#define MAX_NUM_ATTR_BYTES 39
#define MAX_DICT_WORD_SIZE 40
#define MAX_DICT_WORD_BYTES (40*4)
#define MAX_NUM_ATTR_BYTES 39
+#define MAX_VERB_WORD_SIZE 120
#define VENEER_CONSTRAINT_ON_CLASSES_Z 256
#define VENEER_CONSTRAINT_ON_IP_TABLE_SIZE_Z 128
#define VENEER_CONSTRAINT_ON_CLASSES_Z 256
#define VENEER_CONSTRAINT_ON_IP_TABLE_SIZE_Z 128
/* "verbs" : Manages actions and grammar tables; parses the directives */
/* Verb and Extend. */
/* */
/* "verbs" : Manages actions and grammar tables; parses the directives */
/* Verb and Extend. */
/* */
-/* Copyright (c) Graham Nelson 1993 - 2016 */
+/* Copyright (c) Graham Nelson 1993 - 2017 */
/* */
/* This file is part of Inform. */
/* */
/* */
/* This file is part of Inform. */
/* */
{
/* Registers a new English verb as referring to the given Inform-verb
number. (See comments above for format of the list.) */
{
/* Registers a new English verb as referring to the given Inform-verb
number. (See comments above for format of the list.) */
if (find_or_renumber_verb(English_verb, NULL) != -1)
{ error_named("Two different verb definitions refer to", English_verb);
return;
}
if (find_or_renumber_verb(English_verb, NULL) != -1)
{ error_named("Two different verb definitions refer to", English_verb);
return;
}
- English_verb_list_size += strlen(English_verb)+4;
+ /* We set a hard limit of MAX_VERB_WORD_SIZE=120 because the
+ English_verb_list table stores length in a leading byte. (We could
+ raise that to 250, really, but there's little point when
+ MAX_DICT_WORD_SIZE is 40.) */
+ entrysize = strlen(English_verb)+4;
+ if (entrysize > MAX_VERB_WORD_SIZE+4)
+ error_numbered("Verb word is too long -- max length is", MAX_VERB_WORD_SIZE);
+ English_verb_list_size += entrysize;
if (English_verb_list_size >= MAX_VERBSPACE)
memoryerror("MAX_VERBSPACE", MAX_VERBSPACE);
if (English_verb_list_size >= MAX_VERBSPACE)
memoryerror("MAX_VERBSPACE", MAX_VERBSPACE);
- English_verb_list_top[0] = 4+strlen(English_verb);
+ English_verb_list_top[0] = entrysize;
English_verb_list_top[1] = number/256;
English_verb_list_top[2] = number%256;
strcpy(English_verb_list_top+3, English_verb);
English_verb_list_top[1] = number/256;
English_verb_list_top[2] = number%256;
strcpy(English_verb_list_top+3, English_verb);
- English_verb_list_top += English_verb_list_top[0];
+ English_verb_list_top += entrysize;
}
static int get_verb(void)
}
static int get_verb(void)