View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0028659 | Packages | Packages | public | 2015-09-10 21:37 | 2016-11-27 20:01 |
Reporter | wp | Assigned To | Felipe Monteiro de Carvalho | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.5 (SVN) | ||||
Target Version | 1.6 | Fixed in Version | 1.6 | ||
Summary | 0028659: fpvectorials svgreader crash | ||||
Description | As discussed in the forum (http://forum.lazarus.freepascal.org/index.php/topic,29621.0.html) it seems to be within svg specification if no separating space or comma is placed before a negative number, e.g. using "15-15" instead of "15 -15" or "15,-15". I am not 100% sure about this statement, but Firefox definitely can read the "malformed" files appended to the forum discussion. The svgreader of fpvectorial, however, cannot. The tokenizer crashes when trying to convert these strings to numerical values. The attached patch splits strings like "15-15" at the "-" character into its parts "15" and "-15" and makes these files readable by fpvectorial. In tests with Firefox I saw that a "+" character can be used in the same way. Therefore, the patch handles this case as well. | ||||
Steps To Reproduce | Run attached demo (which is adapted from the forum discussion). | ||||
Additional Information | Felipe, I could apply the fix by myself, but since I am not too familiar with fpvectorial I would like you to have a look at it. Please leave me a note if you want me to apply patches to fpvectorial by myself in the future. (BTW, there's a bunch of memory leaks). | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
svgvectorialreader.pas.patch (1,187 bytes)
Index: components/fpvectorial/svgvectorialreader.pas =================================================================== --- components/fpvectorial/svgvectorialreader.pas (revision 49814) +++ components/fpvectorial/svgvectorialreader.pas (working copy) @@ -275,12 +275,14 @@ const Str_Space: Char = ' '; Str_Comma: Char = ','; + Str_Plus: Char = '+'; + Str_Minus: Char = '-'; ListOfCommandLetters: set of Char = ['a'..'d', 'f'..'z', 'A'..'D', 'F'..'Z']; var i: Integer; lTmpStr: string = ''; lState: Integer; - lFirstTmpStrChar, lCurChar: Char; + lFirstTmpStrChar, lCurChar, lPrevChar: Char; begin lState := 0; @@ -290,6 +292,7 @@ case lState of 0: // Adding to the tmp string begin + if i > 0 then lPrevChar := AStr[i-1]; lCurChar := AStr[i]; if lCurChar = Str_Space then begin @@ -302,6 +305,11 @@ AddToken(lTmpStr); lTmpStr := ''; end + else if (lCurChar in [Str_Plus, Str_Minus]) and (lPrevChar in ['0'..'9']) then + begin + AddToken(lTmpStr); + lTmpStr := lCurChar; + end else begin // Check for a break, from letter to number |
|
|
Date Modified | Username | Field | Change |
---|---|---|---|
2015-09-10 21:37 | wp | New Issue | |
2015-09-10 21:37 | wp | Status | new => assigned |
2015-09-10 21:37 | wp | Assigned To | => Felipe Monteiro de Carvalho |
2015-09-10 21:37 | wp | File Added: svgvectorialreader.pas.patch | |
2015-09-10 21:39 | wp | File Added: TestSVG.zip | |
2015-09-10 21:41 | wp | Description Updated | View Revisions |
2015-09-10 21:41 | wp | Additional Information Updated | View Revisions |
2015-10-09 20:56 | wp | Status | assigned => resolved |
2015-10-09 20:56 | wp | Resolution | open => fixed |
2015-10-09 20:56 | wp | Status | resolved => closed |
2015-10-09 20:56 | wp | Status | closed => assigned |
2015-10-09 20:56 | wp | Resolution | fixed => reopened |
2015-10-09 20:56 | wp | Target Version | 1.4.4 => 1.4.6 |
2015-10-09 20:57 | wp | Status | assigned => closed |
2015-10-09 20:57 | wp | Resolution | reopened => fixed |
2016-11-27 20:00 | Bart Broersma | Status | closed => assigned |
2016-11-27 20:00 | Bart Broersma | Resolution | fixed => reopened |
2016-11-27 20:00 | Bart Broersma | Target Version | 1.4.6 => 1.6 |
2016-11-27 20:00 | Bart Broersma | Status | assigned => resolved |
2016-11-27 20:00 | Bart Broersma | Resolution | reopened => fixed |
2016-11-27 20:01 | Bart Broersma | Status | resolved => closed |
2016-11-27 20:01 | Bart Broersma | Fixed in Version | => 1.6 |