Bug 59310 - EPS setmiterlimit of "0 ml" produces /rangecheck error in ghostscript (possible violation of EPS spec)
Summary: EPS setmiterlimit of "0 ml" produces /rangecheck error in ghostscript (possib...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Images-EPS
  Show dependency treegraph
 
Reported: 2013-01-13 07:01 UTC by bahanonu
Modified: 2022-10-24 03:42 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
EPS file, will produce an error unless 0 ml is changed to 1 ml (1.99 KB, application/postscript)
2013-01-13 07:01 UTC, bahanonu
Details
ODG/EPS/PNG test files for setmiterlimit, created under v3304 and v4132. (19.03 KB, application/zip)
2013-11-25 08:54 UTC, Owen Genat (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bahanonu 2013-01-13 07:01:57 UTC
Created attachment 72949 [details]
EPS file, will produce an error unless 0 ml is changed to 1 ml

Problem description: setmiterlimit in EPS file can be set to zero, in violation of specifications

Steps to reproduce:
1. Create a line
2. Right-click 'Edit Style'
3. Corner-style->Mitered
4. Create a point and move it
5. Export as EPS v2 w/ color
6. Open EPS file in text editor, search '0 ml'

Current behavior:
0 ml in EPS file, which produces ghostscript errors
Expected behavior:
d ml in EPS file where d>=1
              
Operating System: Windows 8
Version: 3.6.4.3 release
Comment 1 Owen Genat (retired) 2013-11-25 08:54:07 UTC
Created attachment 89731 [details]
ODG/EPS/PNG test files for setmiterlimit, created under v3304 and v4132.

I can confirm this bug, at least in terms of ghostscript behaviour. It does appear that EPS files generated from Draw are in violation of the Adobe EPS file format specification v3.0:

- http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf

There does not seem to be anything explicit in the spec about the setmiterlimit needing to be anything other than (p.15):

> 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath

Using the instructions provided in comment#0, I created a pair of test ODGs (refer attached) under Ubuntu 10.04 x86_64 running:

- v3.3.0.4 OOO330m19 Build: 6
- v4.1.3.2 Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a

I then exported the line in each to EPS, layer 2, color. These are the "0ml" files attached and contain these lines:

> 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath
> ...
> /ml {setmiterlimit} bdef
> ...
> 0 lw 0 ml 0.003 0.003 0.003 c 2000 2000 m  3000 3000 l  2000 4000 l  ps

A diff of the v3304 and v4132 0ml EPS reveals no significant changes:

$ diff v3304_0ml.eps v4132_0ml.eps 
4c4
< %%Creator: Sun Microsystems, Inc.
---
> %%Creator: LibreOffice 4.1
53,54c53,54
< 0.02791 0.02845 s 
< 0 -2003 t
---
> 0.02797 0.02848 s 
> 0 -2001 t
57c57
< -1999 -1999 t 
---
> -1995 -1997 t 
59,60c59,60
< 0 lw 0 ml 0.003 0.003 0.003 c 2000 2000 m  3000 3000 l  2000 4000 l  ps
< 0 2003 t 
---
> 0 lw 0 ml 0.003 0.003 0.003 c 1996 1998 m  2994 2997 l  1996 3996 l  ps
> 0 2001 t 

I edited the 0ml versions to change the "0 ml" toward the end to read "1 ml" and save these as the 1ml_edited versions of each EPS. Ghostscript reports:

$ gs -dSAFER -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=v3304_0ml.png v3304_0ml.eps 
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /rangecheck in --setmiterlimit--
Operand stack:
   --nostringval--   0
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   --nostringval--   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1157/1684(ro)(G)--   --dict:0/20(G)--   --dict:104/200(L)--   --dict:104/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 1600
GPL Ghostscript 8.71: Unrecoverable error, exit code 1

$ gs -dSAFER -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=v3304_1ml_edited.png v3304_1ml_edited.eps 
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

The results are the same for the v4132 EPSs.
Comment 2 Owen Genat (retired) 2013-11-25 09:00:05 UTC
As per comment #1, confirmed. Status set to NEW. Version set to Inherited From OOo. Platform set to All/All. Edited summary to be clearer as to the nature of the problem.
Comment 3 QA Administrators 2015-04-19 03:22:16 UTC Comment hidden (obsolete)
Comment 4 Julien Nabet 2015-10-31 17:25:15 UTC
Could it be a Ghostscript bug?
Indeed, I don't find any official docs (or perhaps missed it) indicated that 0 can't be a legal value for Miter limit.

Also I noticed that line width was at 0. If changing to not 0 value, Miter limit is different from 0. By taking a look from http://opengrok.libreoffice.org/xref/core/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx#448, I can understand why.
Comment 5 QA Administrators 2016-11-08 11:57:40 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2020-10-23 04:15:09 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2022-10-24 03:42:22 UTC
Dear bahanonu,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug