Bug 73335 - FILESAVE: Misbehaving Macro corrupts .ods file when tracking of changes is enabled: non-well-formed, duplicate table:id attributes on table:cell-content-change
Summary: FILESAVE: Misbehaving Macro corrupts .ods file when tracking of changes is en...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.4.2 release
Hardware: Other All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard: odf odf_validation target:5.3.0 targe...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-06 21:14 UTC by polzin
Modified: 2023-12-16 17:25 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
bug_before.ods is before the application of the macro (11.07 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-01-06 21:14 UTC, polzin
Details
bug_after.ods is after the application of the macro (11.13 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-01-06 21:15 UTC, polzin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description polzin 2014-01-06 21:14:26 UTC
Created attachment 91562 [details]
bug_before.ods is before the application of the macro

A corrupted .ods file will be written, when a VBA-macro does an insert of a partial row with shifting of lines. This is forbidden in the GUI when tracking of changes is enabled, but the macro was able to do this and broke the content.xml. 

The macro:

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub Bug()
  Dim row As Long
  With ActiveSheet
    row = ActiveCell.row
    .Cells(row, 1).Range("A1:B1").Select
    Selection.Copy
    .Cells(row+1, 1).Range("A1:B1").Select
    Selection.Insert    
  End With  
End Sub

Replacing ".Range("A1:B1")" by ".EntireRow" makes the error go away.


bug_after.ods is after the application of the macro

xmllint content.xml gives:
-:2: parser error : Attribute table:id redefined
><table:tracked-changes><table:cell-content-change table:id="ct1" table:id="ct2"

I reported this before in #65363-
Comment 1 polzin 2014-01-06 21:15:12 UTC
Created attachment 91563 [details]
bug_after.ods is after the application of the macro
Comment 2 Yousuf Philips (jay) (retired) 2014-06-08 11:26:13 UTC

*** This bug has been marked as a duplicate of bug 65363 ***
Comment 3 Michael Stahl (allotropia) 2016-07-04 19:10:31 UTC
this bug is about invalid duplicate table:id attributes on table:cell-content-change

this is not a duplicate of 65363, which is duplicate office:currency on table:cell

what is even worse, this serious bug can be reproduced on current master!

the only good aspect of this bug is that we don't know of a way to
reproduce it with the UI, you need a macro, which means it won't affect many.
Comment 4 Michael Stahl (allotropia) 2016-07-04 19:44:20 UTC
was quite easy to avoid the duplicate attributes, although
i don't know enough about Calc to determine if the ScChangeAction
of type SC_CAT_NONE should exist in the first place.
Comment 5 Commit Notification 2016-07-04 19:44:25 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ed913ce8352dc4ad9f4688180a9b27d02e8f524f

tdf#73335 sc: ODF export: ignore ScChangeAction SC_CAT_NONE harder

It will be available in 5.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Eike Rathke 2016-07-04 20:16:14 UTC
SC_CAT_NONE is a result of an unhandled insertion or deletion action, here the partial insertion with cell shift that for a reason is disabled in UI.
Comment 7 Commit Notification 2016-07-04 21:27:07 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9f8e2065c42f1724ac7a24f1bb0531e8c954698a

explicitly disable partial cell shift with change-tracking, tdf#73335 related

It will be available in 5.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2016-07-04 21:44:17 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1b9f0082ba963baa37c8c565bab3b9b893e1a690&h=libreoffice-5-2

tdf#73335 sc: ODF export: ignore ScChangeAction SC_CAT_NONE harder

It will be available in 5.2.0.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2016-07-04 21:45:39 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=638a86ec065f43425065d6459fde05bf60c0e575&h=libreoffice-5-1

tdf#73335 sc: ODF export: ignore ScChangeAction SC_CAT_NONE harder

It will be available in 5.1.5.

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

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2016-07-05 09:37:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f2f076aff2d1d21958b55938cd55f65f0d5a0aa4&h=libreoffice-5-2

explicitly disable partial cell shift with change-tracking, tdf#73335 related

It will be available in 5.2.0.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2016-07-05 09:37:34 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb749f520b94d11ebeaf83c1e913dacb742703b&h=libreoffice-5-1

explicitly disable partial cell shift with change-tracking, tdf#73335 related

It will be available in 5.1.5.

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

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