Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000228Core InformTablespublic2010-08-03 05:542010-10-28 00:30
ReporterPhonatacid 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSMac OS XOS Version10.6
Product Version6E72 
Target VersionFixed in Version6F95 
Summary0000228: A Programming error is triggered when checking if there is a corresponding entry in an empty table name
DescriptionThe error is the following:

[** Programming error: tried to read outside memory using --> **]

Minimal Source Text To Reproduce
"A test area"

There is a room.

Table of Test
symbol	digit
an indexed text	a number

When play begins:
	if there is a symbol of "S" in the Table of Test:
		say "success";
	else:
		say "failure";
Additional InformationA possible workaround is to check if the table is empty before looking if there is a corresponding entry
by putting either:
-if (Adj_16_t1_v72(tab)) rfalse;
or
-if (TableFilledRows(tab) == 0) rfalse;
at the beginning of the ExistsTableLookUpCorr routine from Tables.i6t

For instance

Include(-
[ TableLookUpCorr tab col1 col2 lookup_value write_flag write_value cola1 cola2 i j v f;
if (col1 >= 100) col1=TableFindCol(tab, col1, true);
if (col2 >= 100) col2=TableFindCol(tab, col2, true);
cola1 = tab-->col1;
cola2 = tab-->col2;
j = cola2-->0;
f=0;
if (((tab-->col2)-->1) & TB_COLUMN_ALLOCATED) f=1;
if (((tab-->col2)-->1) & TB_COLUMN_TOPIC) f=2;
for (i=1+COL_HSIZE:i<=j:i++) {
v = cola2-->i;
if ((v == TABLE_NOVALUE) && (CheckTableEntryIsBlank(tab,col2,i-COL_HSIZE))) continue;
if (f == 1) {
if (BlkValueCompare(v, lookup_value) ~= 0) continue;
} else if (f == 2) {
if ((v)(lookup_value/100, lookup_value%100) == GPR_FAIL) continue;
} else {
if (v ~= lookup_value) continue;
}
if (write_flag) {
ForceTableEntryNonBlank(tab,col1,i-COL_HSIZE);
switch (write_flag) {
2: cola1-->i = cola1-->i + write_value;
3: cola1-->i = cola1-->i - write_value;
default: cola1-->i = write_value;
}
rfalse;
}
v = cola1-->i;
if ((v == TABLE_NOVALUE) &&
(CheckTableEntryIsBlank(tab,col1,i-COL_HSIZE))) continue;
return v;
}
return RunTimeProblem(RTP_TABLE_NOCORR, tab);
];

[ ExistsTableLookUpCorr tab col1 col2 lookup_value cola1 cola2 i j f;
if (TableFilledRows(tab) == 0) rfalse;
if (col1 >= 100) col1=TableFindCol(tab, col1, false);
if (col2 >= 100) col2=TableFindCol(tab, col2, false);
if (col1*col2 == 0) rfalse;
cola1 = tab-->col1; cola2 = tab-->col2;
j = cola2-->0;
f=0;
if (((tab-->col2)-->1) & TB_COLUMN_ALLOCATED) f=1;
if (((tab-->col2)-->1) & TB_COLUMN_TOPIC) f=2;
for (i=1+COL_HSIZE:i<=j:i++) {
if (f == 1) {
if (BlkValueCompare(cola2-->i, lookup_value) ~= 0) continue;
} else if (f == 2) {
if ((cola2-->i)(lookup_value/100, lookup_value%100) == GPR_FAIL) continue;
} else {
if (cola2-->i ~= lookup_value) continue;
}
if ((cola1-->i == TABLE_NOVALUE) &&
(CheckTableEntryIsBlank(tab,col1,i-COL_HSIZE))) continue;
rtrue;
}
rfalse;
];
-) instead of "Table Look Up Corresponding Row" in "Tables.i6t".

TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
(0000503)
graham (administrator)
2010-09-03 15:50

I can't find which it is, but I believe this to be related to a previous issue about finding blank entries in tables; at any rate, it's fixed in my working build of Inform.

- Issue History
Date Modified Username Field Change
2010-08-03 05:54 Phonatacid New Issue
2010-08-04 15:01 EmacsUser Status new => confirmed
2010-08-04 15:01 EmacsUser Steps to Reproduce Updated View Revisions
2010-09-03 15:50 graham Note Added: 0000503
2010-09-03 15:50 graham Status confirmed => resolved
2010-09-03 15:50 graham Resolution open => fixed
2010-09-03 15:50 graham Assigned To => graham
2010-10-25 21:14 jmcgrew Fixed in Version => 6F95
2010-10-28 00:30 jmcgrew Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker