Bug 1177922 - ghostscript: txtwrite has memory issues
Summary: ghostscript: txtwrite has memory issues
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Printing (show other bugs)
Version: Current
Hardware: x86-64 Linux
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Johannes Meixner
QA Contact: Johannes Meixner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-20 08:52 UTC by Jan Engelhardt
Modified: 2024-01-10 12:50 UTC (History)
1 user (show)

See Also:
Found By: Community User
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2020-10-20 08:52:56 UTC
Tumbleweed: [ghostscript-9.52-2.2.x86_64]

» wget https://interoperability.blob.core.windows.net/files/MS-OXCMSG/%5bMS-OXCMSG%5d-181001.pdf
» md5sum *pdf
434487f9faea2e8fe9f451b031a474a3  [MS-OXCMSG]-181001.pdf
» ps2ascii \[MS-OXCMSG\]-181001.pdf 
malloc(): corrupted top size
/usr/bin/ps2ascii: line 21: 11109 Aborted                 (core dumped) $GS_EXECUTABLE $OPTIONS -o - "$1"


15.2: [ghostscript-9.52-lp152.2.4.1.x86_64]

gs: malloc.c:2422: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Comment 1 Johannes Meixner 2020-10-20 09:57:34 UTC
/usr/bin/ps2ascii is a script that calls basically
"gs -q -dSAFER -sDEVICE=txtwrite" so the root cause
is related to the txtwrite device of Ghostscript.

I can reproduce it with Ghostscript 9.52
on my openSUSE Leap 15.1 homeoffice laptop
with "normal" PDFs (but not with PostScript files) like
----------------------------------------------------------------------------
# cat /usr/share/doc/release-notes/openSUSE/RELEASE-NOTES.en.pdf \
 | gs -q -dSAFER -sDEVICE=txtwrite -o - - \
 | cat - >openSUSE_RELEASE-NOTES.en.txt

*** Error in `gs': malloc(): memory corruption: 0x00000000011c1c60 ***
----------------------------------------------------------------------------
and
----------------------------------------------------------------------------
# cat /usr/share/doc/release-notes/openSUSE/RELEASE-NOTES.de.pdf \
 | gs -q -dSAFER -sDEVICE=txtwrite -o - - \
 | cat - >openSUSE_RELEASE-NOTES.de.txt

gs: malloc.c:2422: sysmalloc: Assertion `(old_top == initial_top (av)
 && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE
 && prev_inuse (old_top)
 && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
----------------------------------------------------------------------------
interestingly there are different error messages which seem to depend
on the language of the openSUSE RELEASE-NOTES PDF ;-)

I found bugs at Ghostscript upstream with txtwrite memory issues like
https://bugs.ghostscript.com/show_bug.cgi?id=702229
and its duplicate
https://bugs.ghostscript.com/show_bug.cgi?id=702346
also with different error messages but perhaps all have in the end
the same root cause.

I will test latest Ghostscript 9.53 (need to build that first)...
Comment 2 Johannes Meixner 2020-10-20 15:02:55 UTC
Ghostscript 9.53.3 from OBS home:jsmeix:branches:Printing ghostscript
works with the txtwrite Ghostscript device for
https://interoperability.blob.core.windows.net/files/MS-OXCMSG/%5bMS-OXCMSG%5d-181001.pdf
and also for the other PDFs where it had failed before.
Comment 3 Johannes Meixner 2020-10-20 15:17:19 UTC
Submitted to OBS Printing project
and also directly to openSUSE:Factory
because of https://build.opensuse.org/request/show/842834

--------------------------------------------------------------------------
# osc submitrequest -m 'Ghostscript version upgrade to 9.53.3 \
 that fixes boo#1177922 and fixes compilation with FreeType 2.10.3+' \
 home:jsmeix:branches:Printing ghostscript Printing ghostscript

created request id 843001

# osc request accept -m 'Ghostscript version upgrade to 9.53.3 that \
 fixes boo#1177922 and fixes compilation with FreeType 2.10.3+' 843001

Result of change request state: ok
openSUSE:Factory 
Forward this submit to it? ([y]/n)y
Ghostscript version upgrade to 9.53.3 that fixes boo#1177922
and fixes compilation with FreeType 2.10.3+
(forwarded request 843001 from jsmeix)
New request # 843002
--------------------------------------------------------------------------
Comment 4 OBSbugzilla Bot 2020-10-20 15:50:07 UTC
This is an autogenerated message for OBS integration:
This bug (1177922) was mentioned in
https://build.opensuse.org/request/show/843002 Factory / ghostscript
Comment 5 Johannes Meixner 2020-10-23 11:00:37 UTC
This issue is fixed because
https://build.opensuse.org/request/show/843002
is accepted.
Comment 6 Johannes Meixner 2020-10-26 09:27:36 UTC
Ghostscript 9.53.3 was released in Tumbleweed snapshot 20201023
https://lists.opensuse.org/opensuse-factory/2020-10/msg00250.html