https://bugs.documentfoundation.org/show_bug.cgi?id=167948
Bug ID: 167948
Summary: LibreOffice crashes when calling insertDocumentFromURL
with a HTML file
Product: LibreOffice
Version: 25.2.0.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: [email protected]
Reporter: [email protected]
Description:
Zotero users of LibreOffice 25.2 have started reporting LibreOffice crashes
when attempting to insert notes into their documents. I have investigated our
code and determined it to be the call to insertDocumentFromURL which is causing
it.
The issue is not present in major releases previous to 25.2.
Steps to Reproduce:
Run `insertText("<html><body>Comment: 38 pages, 13 figures, 6 tables. Submitted
to Phys. Rev. D</body></html>")`:
```
public void insertText(String textString) throws Exception {
XTextCursor viewCursor = getSelection();
XText text = viewCursor.getText();
XTextCursor cursor = text.createTextCursorByRange(viewCursor);
XTextRange preNewline, postNewline;
preNewline =
text.createTextCursorByRange(viewCursor).getStart();
postNewline =
text.createTextCursorByRange(viewCursor).getEnd();
// move citation to its own paragraph so its formatting isn't
altered automatically
// because of the text on either side of it
text.insertControlCharacter(preNewline,
ControlCharacter.PARAGRAPH_BREAK, true);
text.insertControlCharacter(postNewline,
ControlCharacter.PARAGRAPH_BREAK, true);
insertHTML(textString, cursor);
// remove previously added paragraphs
preNewline.setString("");
postNewline.setString("");
}
public void insertHTML(String text, XTextCursor cursor) throws
Exception {
PropertyValue filterName = new PropertyValue();
filterName.Name = "FilterName";
filterName.Value = "HTML Document";
PropertyValue inputStream = new PropertyValue();
inputStream.Name = "InputStream";
try {
inputStream.Value = new
StringInputStream(text.getBytes("ISO-8859-1"));
} catch (UnsupportedEncodingException e) {
return;
}
((XDocumentInsertable)
UnoRuntime.queryInterface(XDocumentInsertable.class, cursor)).
insertDocumentFromURL("private:stream", new
PropertyValue[] {filterName, inputStream});
}
```
Actual Results:
LibreOffice 25.2+ crashes
Expected Results:
LibreOffice inserts the HTML and continues running.
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: lt-LT (en_US.UTF-8); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.