Bug 73524 - CDT 2.0.1 freezes after trying to open a large .c file
Summary: CDT 2.0.1 freezes after trying to open a large .c file
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 critical with 1 vote (vote)
Target Milestone: 2.0.1   Edit
Assignee: John Camelon CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-09 05:04 EDT by Boris von Loesch CLA
Modified: 2004-09-10 09:33 EDT (History)
3 users (show)

See Also:


Attachments
After opening this file, eclipse hangs (106.10 KB, text/plain)
2004-09-09 09:46 EDT, Boris von Loesch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Boris von Loesch CLA 2004-09-09 05:04:30 EDT
I updated my eclipse cdt from 2.0 to 2.0.1. Updating works fine, but after the
update I have tried to open a large .c file, instead of opening the file eclipse
freezes and the processor load is at 99% (maybe endless loop). Opening other .c
or .h files works fine. In the newsgroup someone told, that he have the same
problem with a smale .c file (~ 400 lines) under linux. I am working with
eclipse 3.0 under winxp.
Comment 1 John Camelon CLA 2004-09-09 08:36:15 EDT
I need a source-code example in order to triage the defect appropriately.  
Comment 2 Boris von Loesch CLA 2004-09-09 09:46:48 EDT
Created attachment 14459 [details]
After opening this file, eclipse hangs
Comment 3 John Camelon CLA 2004-09-09 10:12:06 EDT
I see the hang. 
We need to fix this for 2.0.2.
Comment 4 John Camelon CLA 2004-09-09 14:52:57 EDT
There was a bug in the scanner that was continually creating the same token 
w/buffer length 0 over and over and chaining them together for the parser.  
This was causing the infinite loop.  

I fixed the Scanner to be more robust and protect against this.  
I also fixed the Scanner bug that started this incorrect behaviour flowing.  
We were not handling escaped newlines within strings well on Windows. (look 
for \r as well!)

I've created a JUnit to ensure this won't happen again.  
Fix applied to HEAD, AST2 & 2_0 branches.  
Comment 5 John Camelon CLA 2004-09-09 15:10:46 EDT
For Kleo: 
The code that would cause the infinite loop in the Parser/Scanner was: 

    static char fmt_1002[] = "(/,\002At iterate\002,i5,4x,\002f= \002,1p,d12\
.5,4x,\002|proj g|= \002,1p,d12.5)";

We were mishandling the escaped newline, as all newlines are \r\n on Windows.