Bug 125151 - Easy to delete form fields in protected sections
Summary: Easy to delete form fields in protected sections
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.2 rc
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.3.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2019-05-07 07:41 UTC by Justin L
Modified: 2019-05-09 08:08 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
deleting_fieldmarks.doc: the three types of fieldmarks are easily deleted in protected sections (10.00 KB, application/msword)
2019-05-07 07:41 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2019-05-07 07:41:11 UTC
Created attachment 151212 [details]
deleting_fieldmarks.doc: the three types of fieldmarks are easily deleted in protected sections

If the cursor is at the start of the formfield, then a delete will erase the entire field.

This problem started in LO 6.2 with https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-4-4&id=63ec2e8d07dff652a68c9dc96859c4c61f26b9df for bug 122201.

author	Serge Krot 2018-12-20 19:24:56 +0100
tdf#122201 sw: DOCX: allow editing of unprotected areas in protected doc

It looks like a delete request must pass several read-only checks, with Serge's change of meaning of the protect_form flag, all the tests pass. If a section is already protected, then the code follows a different path when evaluating whether fieldmarks are editable, so a different outcome occurs if the section is marked as protected.

Steps to reproduce:
1.) open the attached document and notice that each section is protected
2.) place the cursor in front of the checkbox and combobox and press delete.
The entire field is deleted.  Also true with the textbox, although you really need to make sure you are at the beginning of the textbox definition.

Confirmation
A.) reload the test document
B.) edit the section and remove the protection.
C.) again attempt to delete the items
A "protected form" dialog tells you that editing here is not allowed. The checkbox and combobox cannot be deleted (because Options/Writer/Compatibility/Protect Forms is still enabled). The textbox can still be deleted however.
Comment 1 Justin L 2019-05-07 18:48:59 UTC
proposed fix at https://gerrit.libreoffice.org/71927

LO6.2's commit 63ec2e8d07dff652a68c9dc96859c4c61f26b9df accurately identfied that this is in a protected section, and so exposed this missing scenario.
Comment 2 Commit Notification 2019-05-09 08:05:35 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#125151 sw: allow protection around field marks

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 3 Justin L 2019-05-09 08:08:55 UTC
I'm not planning to backport this to 6.2 where the problem was first seen - too much chance of some obscure edge case being blocked from editing etc.