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:
parent
ede231c47e
commit
fb62ab1e5c
2 changed files with 13 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue