Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10285 closed Bug (fixed)

Styled text pasted from MS Word causes infinite loop

Reported by: Jakub Ś Owned by: Piotrek Koszuliński
Priority: Normal Milestone: CKEditor 4.1.1
Component: Plugin : Paste from Word Version: 4.1
Keywords: Cc:

Description

To reproduce:

  1. Use below configuration for editor
    var editor = CKEDITOR.replace( 'editor1', {
    	pasteFromWordRemoveFontStyles:false,
    	pasteFromWordRemoveStyles : false 	
    	//,allowedContent: true //This isn't causing any problems
    } );	
    
  2. Open page and clear contents with New Page command
  3. Open attached file and Copy styled text or table with styled text
  4. Paste it in to editor using Paste From Word dialog or Ctrl+V

Result: CKEditor goes into infinite loop (FF eventually asks if you want to break the script execution).

Problem can be reproduced in all browsers from CKE 4.1 however it looks like ACF is not responsible as setting allowedContent: true doesn't help to resolve this problem.

Attachments (1)

test.docx (15.5 KB) - added by Jakub Ś 12 years ago.

Download all attachments as: .zip

Change History (15)

Changed 12 years ago by Jakub Ś

Attachment: test.docx added

comment:1 Changed 12 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 12 years ago by Piotrek Koszuliński

Owner: set to Piotrek Koszuliński
Status: confirmedassigned

I simplified the test case to this HTML:

<p class="MsoNormal"><span style="font-size:24.0pt">test</span></p>

It completely loops this for loop https://github.com/ckeditor/ckeditor-dev/blob/master/core/htmlparser/fragment.js#L529-L534

I also found that commenting out these two lines stops loop: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/pastefromword/filter/default.js#L938-L939

Although this isn't of course fix for this issue. Now it's time to simplified filter rules in order to be able to track how the inf loop looks like, because it is very complex. By marking filtered nodes I only learnt that element#filterChildren starts processing offline nodes that has to be somewhere created.

comment:3 Changed 12 years ago by Piotrek Koszuliński

I extracted #10327 which fixes one issue in htmlParser.filter. Unfortunately, fixing this issue reveals whole bunch of other in pastefromword filter. I was able to track one of them easily (styleElement in line :603 does not have parent set to element), but I found next inf loop. I don't want to debug it, because it is a waste of time, since we're planning #9991.

I'll try to find hack for this issue.

comment:4 Changed 12 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.1.1
Status: assignedreview

Pushed t/10285 on dev with a hack that prevents from falling in infinite loop.

comment:5 Changed 12 years ago by Piotrek Koszuliński

I pushed also a test which helps in validating this patch.

comment:6 Changed 12 years ago by Frederico Caldeira Knabben

For instance, I'm not able to reproduce this issue with Word for Mac 2011.

comment:7 Changed 12 years ago by Piotrek Koszuliński

Sorry, I forgot to mention that I wasn't able too. Kuba had to send me HTML generated from his Word. We've got nearly the same version (just last two digits differs) and the same OS, but something was different.

Although try pasting that HTML I posted above and you will blow up editor. There's definitely an issue, I'm sure about that.

Last edited 12 years ago by Piotrek Koszuliński (previous) (diff)

comment:8 Changed 12 years ago by Frederico Caldeira Knabben

Status: reviewreview_passed

comment:9 Changed 12 years ago by Olek Nowodziński

I confirm that t/10285 fixes inf loop in this case:

<p class="MsoNormal"><span style="font-size:24.0pt">test</span></p>

comment:10 Changed 12 years ago by Piotrek Koszuliński

Resolution: fixed
Status: review_passedclosed

Fixed on master with git:3e1df4d on dev and 73f869d on tests.

comment:11 Changed 12 years ago by Jakub Ś

I can confirm review_passed. I have tested this issue on all browsers and no infinite loop has occurred.

comment:12 Changed 12 years ago by Mike Kelley

I would like to mention that this still occurs. We noticed then when we tried to paste from Outlook to CKEditor.

To reproduce:

1) open any html email in Outlook ( I used 2013 )
2) copy html content, ctrl-a / ctrl-c
3) past content into ckeditor ctrl-v, or click the paste button

The entire browser becomes unresponsive, and has to be killed.

Version 2, edited 12 years ago by Mike Kelley (previous) (next) (diff)

comment:13 Changed 12 years ago by Piotrek Koszuliński

I reported #10498 for this issue, because it's not the same issue if it is Outlook. Could you give us more information in that ticket?

comment:14 Changed 11 years ago by Frederico Caldeira Knabben

Component: GeneralPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy