| Summary: | Accessing uninitialized TextInputStream methods crashes | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Mike Kaganski <mikekaganski> |
| Component: | BASIC | Assignee: | Baole Fang <baole.fang> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | buzea.bogdan, mentoring |
| Priority: | medium | Keywords: | difficultyBeginner, easyHack, skillCpp |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | target:7.6.0 target:7.5.3 | ||
| Crash report or crash signature: | Regression By: | ||
| Bug Depends on: | |||
| Bug Blocks: | 133092 | ||
Repro with Version: 7.5.0.0.alpha0+ / LibreOffice Community Build ID: 21a31eefab1401d288dbb8220f3df3365be9efaf CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Calc: threaded LibreOffice crashes as reported by the OP. The interpreter should have treated this as a runtime exception and caught the error before crashing. I start working on this. Baole Fang committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/16242898da50fbf680df558cb47d1978c3304572 tdf#150135: Fix OTextInputStream to throw runtime exception when uninitialized It will be available in 7.6.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. Baole Fang committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/bf6d1e58031c56dbe85995572deabd35200c9c74 tdf#150135: Fix OTextInputStream to throw runtime exception when uninitialized It will be available in 7.5.3. 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. |
Sub crash stream = CreateUnoService("com.sun.star.io.TextInputStream") stream.available() End Sub This crashes the process, which is an unacceptable outcome (it should raise an exception, translated to Basic run-time error). The code of OTextInputStream [1] does not check if its mxStream is valid before dereferencing. The easy hack is to add the checking code, that would throw an appropriate runtime exception. [1] https://opengrok.libreoffice.org/xref/core/io/source/TextInputStream/TextInputStream.cxx?r=ed9ff1a3#53