Bug 64646 - filesave crash on .xls .xlsx save when change track contains record to deleted sheets
Summary: filesave crash on .xls .xlsx save when change track contains record to delete...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.1.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0 target:6.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-15 19:10 UTC by John Ebli
Modified: 2019-10-31 16:32 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Crash report (68.15 KB, text/plain)
2013-05-15 19:10 UTC, John Ebli
Details
attachment-22657-0.html (2.95 KB, text/html)
2013-05-22 15:54 UTC, John Ebli
Details
attachment-22657-1.dat (1 bytes, multipart/alternative)
2013-05-22 15:54 UTC, John Ebli
Details
Workout2013.xls (739.00 KB, application/vnd.ms-excel)
2013-05-22 15:54 UTC, John Ebli
Details
console + bt with symbols on master sources (14.83 KB, text/plain)
2013-05-28 18:20 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Ebli 2013-05-15 19:10:59 UTC
Created attachment 79360 [details]
Crash report

Crashes every time file is saved as .xlsx
Crashes after more than one cell has been modified/pasted when saved as .xls
Will not crash .xls save if saved as .ods prior to saving as .xls

Problem occurs in current version and previous version.
Problem started when sheet is added with cells linked to another sheet.
Once sheet is added, it cannot be deleted.

Process:         soffice [299]
Path:            /Applications/LibreOffice.app/Contents/MacOS/soffice
Identifier:      org.libreoffice.script
Version:         4.0.3.3 (???)
Code Type:       X86 (Native)
Parent Process:  launchd [158]
User ID:         501

Date/Time:       2013-05-15 13:37:25.324 -0500
OS Version:      Mac OS X 10.8.3 (12D78)
Report Version:  10

Interval Since Last Report:          52 sec
Crashes Since Last Report:           2
Per-App Crashes Since Last Report:   2
Anonymous UUID:                      7F071085-75B0-DE86-C9B4-9E3819308374
Comment 1 Julien Nabet 2013-05-17 21:32:08 UTC
Jan: could it be fixed by http://cgit.freedesktop.org/libreoffice/core/commit/?id=9da54417345c6069d995bdabae7d7dd6de40d1a6 on master sources?

John: could you attach the file so we can try to reproduce the problem?
Comment 2 John Ebli 2013-05-22 15:54:02 UTC
Created attachment 79666 [details]
attachment-22657-0.html

From: bugzilla-daemon@freedesktop.org
To: johnebli1000@hotmail.com
Subject: [Bug 64646] filesave crash on .xls .xlsx save with cells linked between sheets
Date: Fri, 17 May 2013 21:32:08 +0000


    
      
    
     Julien Nabet
 changed
              bug 64646
        

             
          
            What
            Removed
            Added
          

         
           Status
           UNCONFIRMED
           
           NEEDINFO
           
         

         
           CC
           
                
           
           kendy@suse.cz, serval2412@yahoo.fr
           
         

         
           Ever confirmed
           
                
           
           1
           
         
      
        

            Comment # 1
              on bug 64646
              from  Julien Nabet

        Jan: could it be fixed by
http://cgit.freedesktop.org/libreoffice/core/commit/?id=9da54417345c6069d995bdabae7d7dd6de40d1a6
on master sources?

John: could you attach the file so we can try to reproduce the problem?
        
      

      
      You are receiving this mail because:
      
      
          You reported the bug.
Comment 3 John Ebli 2013-05-22 15:54:02 UTC
Created attachment 79667 [details]
attachment-22657-1.dat
Comment 4 John Ebli 2013-05-22 15:54:02 UTC
Created attachment 79668 [details]
Workout2013.xls
Comment 5 Julien Nabet 2013-05-28 18:20:56 UTC
Created attachment 79909 [details]
console + bt with symbols on master sources

On pc Debian x86-64 with master sources updated today, I reproduced the crash.

I attached console logs and bt.
Comment 6 Julien Nabet 2013-05-28 18:27:35 UTC
John: thank you for the attachment. I put this tracker to NEW. Next time, please don't answer from your emailer but by using this link for attachment+comment:
https://bugs.freedesktop.org/attachment.cgi?bugid=64646&action=enter
and this link for just comment:
https://bugs.freedesktop.org/show_bug.cgi?id=64646#


Markus: the bt shows a problem with number formatting.
This patch helps (at least I don't have the same bt):
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 34ae049..af41467 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3306,8 +3306,10 @@ sal_uInt32 ScDocument::GetNumberFormat( const ScRange& rRange ) const
 sal_uInt32 ScDocument::GetNumberFormat( const ScAddress& rPos ) const
 {
     SCTAB nTab = rPos.Tab();
-    if ( maTabs[nTab] )
+    if ( nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
+    {
         return maTabs[nTab]->GetNumberFormat( rPos );
+    }
     return 0;
 }
But then I have another crash. I can provide the new bt if needed but I wonder if it's useful since I know you work on this part.
What do you suggest?
Comment 7 Markus Mohrhard 2013-05-29 20:58:54 UTC
> But then I have another crash. I can provide the new bt if needed but I
> wonder if it's useful since I know you work on this part.
> What do you suggest?

This is a bit nasty. The change tracking contains references to a deleted sheet but does not contain change track information about deleting the sheet.

Your patch might be necessary but right now it is too simple until we understand why there is a reference to a sheet that does not appear anywhere in the change tracking information.

Currently I suspect that it might in fact be an import issue that results in a more or less corrupt change tracking state but without more inspection I can't confirm that.
Comment 8 John Ebli 2013-06-11 17:13:26 UTC
.xls saves also crash occasionally after a sheet has been edited and successfully saved as an .ods
If the .ods is recovered/reloaded, the next save as .xls will work.
Comment 9 John Ebli 2013-08-22 14:29:57 UTC
Problem still exists with Version 4.0.4.2

If I edit the document, save it as .ods, then save as .xls without reopening the .ods version, it will crash.

If I save the document as and .ods
then reopen the .ods file and save it as .xls, it works every time.
Comment 10 John Ebli 2013-09-05 13:48:17 UTC
v4.1.1.2 still crashes every time a document is saved as .xlsx
Comment 11 Joel Madero 2015-05-02 15:41:19 UTC Comment hidden (obsolete)
Comment 12 Buovjaga 2015-06-20 12:54:47 UTC
(In reply to John Ebli from comment #0)
> Crashes every time file is saved as .xlsx
> Crashes after more than one cell has been modified/pasted when saved as .xls
> Will not crash .xls save if saved as .ods prior to saving as .xls

attachment 79668 [details] doesn't crash anymore with the above actions. WFM.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 3ecef8cedb215e49237a11607197edc91639bfcd
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-06-19_23:16:58
Locale: fi-FI (fi_FI)

Ubuntu 15.04 64-bit 
Version: 5.1.0.0.alpha1+
Build ID: 3ecef8cedb215e49237a11607197edc91639bfcd
TinderBox: Linux-rpm_deb-x86_64@46-TDF-dbg, Branch:master, Time: 2015-06-20_00:06:19
Locale: en-US (en_US.UTF-8)
Comment 13 Commit Notification 2019-04-12 07:52:53 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/b240c12ef26d9bfb4e2580b1304e5180fb83e1aa%5E%21

crashtesting: failed on reexport of fdo64646-4.xls

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2019-10-31 16:32:14 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3adfa69d85fd6600ad34b683f2d99900331cf2fa

crashtesting: null deref on import of fdo64646-4.xls

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.