1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-04 13:29:35 +00:00

Be sure to check the availability of code entries before accessing them.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5691 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-06-06 22:01:04 +00:00
parent 61c1f6b270
commit cff1a6ffdb

View File

@ -1247,16 +1247,14 @@ unsigned OptPtrLoad15 (CodeSeg* S)
/* Walk over the entries */
unsigned I = 0;
while (I < CS_GetEntryCount (S) - 3) {
while (I < CS_GetEntryCount (S)) {
CodeEntry* L[5];
unsigned Len;
/* Get next 3 entries */
CS_GetEntries (S, L, I, 3);
/* Check for the start of the sequence */
if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP &&
if (CS_GetEntries (S, L, I, 3) &&
L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP &&
L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP &&
!CS_RangeHasLabel (S, I+1, 2) &&
(Len = strlen (L[0]->Arg)) > 0 &&