1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fix ArrayIndexOutOfBoundsException from bug 84270

This commit is contained in:
Andrew Niefer 2005-07-22 19:21:28 +00:00
parent ede231c47e
commit fb62ab1e5c
2 changed files with 13 additions and 0 deletions

View file

@ -2354,4 +2354,14 @@ public class Scanner2Test extends BaseScanner2Test
validateEOF();
}
public void testbug84270() throws Exception {
Writer writer = new StringWriter();
writer.write("#define h g( ~\n"); //$NON-NLS-1$
writer.write("#define g f\n"); //$NON-NLS-1$
writer.write("#define f(a) f(x * (a))\n"); //$NON-NLS-1$
writer.write("h 5) \n"); //$NON-NLS-1$
initializeScanner( writer.toString() );
fullyTokenize();
}
}

View file

@ -3979,6 +3979,9 @@ abstract class BaseScanner implements IScanner {
while (bufferPos[bufferStackPos] < limit) {
skipOverWhiteSpace();
if( bufferPos[bufferStackPos] + 1 >= limit )
break;
if (buffer[++bufferPos[bufferStackPos]] == ')') {
// end of macro
break;