Issue 124188 - CRASH when pasting grouped contents from Draw over a selected image
Summary: CRASH when pasting grouped contents from Draw over a selected image
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.1.0
Assignee: Oliver-Rainer Wittmann
QA Contact: Clarence GUO
Keywords: crash
Depends on:
Reported: 2014-02-05 21:15 UTC by lauhub
Modified: 2017-05-20 10:35 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Simle Test Kit (41.63 KB, application/x-zip-compressed)
2014-02-12 15:16 UTC, Rainer Bielefeld
no flags Details
Avoid NULL pointer access (735 bytes, patch)
2014-02-14 13:45 UTC, Andre
orw: review-
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description lauhub 2014-02-05 21:15:47 UTC
I have a bitmap image into Writer. It is into a table and is a bitmap.

I copy this image into Draw and add some elements (text, arrow, lines, rectangles). I associate the image with these elements (making a group). Then I copy the group to the clipboard.

Switching back to Writer, the image is still selected. I paste the image and then OO crashes (both writer and draw, loosing any changes made since last save).

This bug seems to happen almost every time I do this on Mavericks. Not tested on other platforms/versions.

I think there is too much bug into this version to consider it is "production ready".
Comment 1 Rainer Bielefeld 2014-02-08 16:31:56 UTC
NOT Reproducible with "AOO 4.0.1 – German UI / German locale [Rev. 1524958 2013-09-20 11:40:29]" on German WIN7 Home Premium (64bit)", “historic” 4.0 User Profile used for all predecessor versions

Thank you for your feedback – unfortunately important information we will 
need to reproduce your problem is missing.
Please add all information requested in following:
b) Attach a sample document (not only screenshot) or refer to an existing 
  sample document in an other Bug with a link; to attach a file to this 
  bug report, just click on "Add an attachment" right on this page.
  If you want to attach a test kit with multiple documents zip them into
  a single and attach the
c) Contribute a document related step by step instruction containing every 
  key press and every mouse click how to reproduce your problem 
e) if possible contribute an instruction how to create a sample document 
  from the scratch
f) add information 
  f4) concerning your Operating System (Language)
  f5) concerning your AOO version (with Build/revision ID if it's not a 
     public release) and localization (UI language, Locale setting)
  f6) AOO settings that might be related to your problems 
     (video hardware acceleration, ...)
  f7) how you launch AOO and how you opened the sample document
  f8) Whether your problem persists after you have renamed your user profile 
     (Quit Quickstart before!) before you launch AOO (please see
  f9) Whether that worked in former OOO / AOO Versions 
Please do not cite these hints in your reply, but cite the items like:
f7): Desktop-icon for soffice.exe / AOO File menu -> Open
Comment 2 lauhub 2014-02-12 12:31:33 UTC

c) In the writer document, paste a bitmap image.
Select this image, and set the "As character" anchor.
Copy the bitmap image to the clipboard
Open a Draw document. Paste the image (Cmd-V) 
Add some objects (boxes and lines).
Select all the objects and the image.
Group the objects
Press Cmd-C (copy)
Go back to the Writer Document.
Select the image (it should already be selected)
Press Cmd-V (paste)

OO crashes.

e) any new document with an images with "As character" anchor following the step above.

f4) Mac OS X 10.9.1 french language
f5) AOO401m5(Build:9714)  -  Rev. 1524958
2013-09-20 11:07:55 (Fri, 20 Sep 2013)
French localization
f6) none
f7) Launched AOO from the Mac OS X LaunchPad. Create a new document from the AOO main menu
f8) did not find the instructions for Mac and have not the time to search.
f9) I don't know
Comment 3 Rainer Bielefeld 2014-02-12 15:16:05 UTC
Still Reproducible with reporter's document or attached test kit and server installation of "AOO 4.1.0-Dev – English UI / German locale - [AOO410m1(Build:9750) - Rev. 1566800 - 2014-02-12]" on German WIN7 Home Premium (64bit)", own separate user profile.

Steps with test kit
0. Download / Unzip test kit
1. Open "target.odt" and "Source.odg"
2. In "Source.odg" select the Smileys (grouped Shapes) with single mouse click
3. <control+c> for copy
4. Switch back to "target.odt" 
5. Single click raster graphic "Computer" 
6. <control+v> for paste

Additional info:
h) Already reproducible with OOo 2.0.2
i) Still worked fine with OOo 1.1.5 (completely different behavior.
Comment 4 Rainer Bielefeld 2014-02-12 15:16:51 UTC
Created attachment 82568 [details]
Simle Test Kit

See comment above how to use!
Comment 5 Rainer Bielefeld 2014-02-12 15:19:15 UTC
(j): LibO 4.1.3 also affected
Comment 6 Andre 2014-02-14 13:45:26 UTC
Created attachment 82591 [details]
Avoid NULL pointer access

The crash is caused in SwDoc::Insert by accessing an SwTxtNode that does not exist.  Calling InsertItem() only when the pointer returned by rRg.GetPoint()->nNode.GetNode().GetTxtNode() is not NULL fixes the crash. 

The document looks like expected after the insert but I don't know enough about the Writer internals to be sure.
Comment 7 Oliver-Rainer Wittmann 2014-02-17 12:15:10 UTC
taking over to review Andre's patch
Comment 8 Oliver-Rainer Wittmann 2014-02-18 09:01:51 UTC
Comment on attachment 82591 [details]
Avoid NULL pointer access

The patch avoids the crash, but the document is afterwards in an inconsistent state as the anchor attribute for the as-character anchored object inside the corresponding text node is missing.
Comment 9 Oliver-Rainer Wittmann 2014-02-18 09:02:31 UTC
Comment on attachment 82591 [details]
Avoid NULL pointer access

obsoleting this patch
Comment 10 Oliver-Rainer Wittmann 2014-02-18 09:02:50 UTC
fix in progress
Comment 11 SVN Robot 2014-02-18 11:47:14 UTC
"orw" committed SVN revision 1569286 into trunk:
124188: <SwDoc::InsertDrawObj(..)> - assure correct insertion of text attribu...
Comment 12 Oliver-Rainer Wittmann 2014-02-18 11:53:03 UTC
fixed in trunk for the next release
Comment 13 Clarence GUO 2014-02-27 09:51:51 UTC
Verified on AOO Rev 1571942 en-US, no crash, so change status to verified

Test ENV: Win7 professional 64 bit SP1, Chinese version.