File: 37_emptystring.patch

package info (click to toggle)
fig2dev 1%3A3.2.9a-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,708 kB
  • sloc: ansic: 38,164; sh: 7,981; makefile: 162; csh: 12
file content (89 lines) | stat: -rw-r--r-- 2,838 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Tue, 8 Apr 2025 19:48:23 +0200
Origin: upstream, https://sourceforge.net/p/mcj/fig2dev/ci/818cc13
Bug: https://sourceforge.net/p/mcj/tickets/195/
Forwarded: not-needed
Subject: Recognize a text object with an empty string, #195
 This is a regression that was probably introduced with commit [76276a].

--- a/fig2dev/read.c
+++ b/fig2dev/read.c
@@ -1666,7 +1666,13 @@ read_textobject(FILE *fp, char **restric
 		free(t);
 		return NULL;
 	}
-	start = *line + i + 1;
+	if ((*line)[i] == ' ' || (*line)[i] == '\t') {
+		start = *line + i + 1;
+	} else {
+		put_msg(Err_incomp, "text", *line_no);
+		free(t);
+		return NULL;
+	}
 	end = find_end(start, v30_flag);
 
 	if (end) {
--- a/fig2dev/tests/output.at
+++ b/fig2dev/tests/output.at
@@ -2,7 +2,7 @@ dnl Fig2dev: Translate Fig code to vario
 dnl Copyright (c) 1991 by Micah Beck
 dnl Parts Copyright (c) 1985-1988 by Supoj Sutanthavibul
 dnl Parts Copyright (c) 1989-2015 by Brian V. Smith
-dnl Parts Copyright (c) 2015-2024 by Thomas Loimer
+dnl Parts Copyright (c) 2015-2025 by Thomas Loimer
 dnl
 dnl Any party obtaining a copy of these files is granted, free of charge, a
 dnl full and unrestricted irrevocable, world-wide, paid up, royalty-free,
@@ -22,7 +22,7 @@ dnl Check various features related to th
 AT_BANNER([Test epic/eepic output language.])
 
 dnl AT_SETUP([---- last character here -----------------v
-AT_SETUP([Write complete output file in page mode (-P)])
+AT_SETUP([write complete output file in page mode (-P)])
 AT_KEYWORDS(epic)
 AT_CHECK([fig2dev -Lepic -P $srcdir/data/line.fig line.tex])
 AT_CLEANUP
@@ -393,7 +393,7 @@ AT_CLEANUP
 
 AT_BANNER([Test other output languages.])
 
-AT_SETUP([Respect -F option for bitmap outputs])
+AT_SETUP([respect -F option for bitmap outputs])
 AT_KEYWORDS(bitmaps)
 AT_SKIP_IF([NO_GS])
 AT_CHECK([fig2dev -F - textbox.ppm <<EOF
--- a/fig2dev/tests/read.at
+++ b/fig2dev/tests/read.at
@@ -430,7 +430,7 @@ EOF
 ])
 AT_CLEANUP
 
-AT_SETUP([Ignore splines with only co-incident points])
+AT_SETUP([ignore splines with only co-incident points])
 AT_KEYWORDS([read.c])
 AT_CHECK([fig2dev -L box <<EOF
 FIG_FILE_TOP
@@ -608,7 +608,7 @@ EOF
 ])
 AT_CLEANUP
 
-AT_SETUP([Allow text with leading spaces, ticket #181])
+AT_SETUP([allow text with leading spaces, ticket #181])
 AT_KEYWORDS([read.c])
 AT_CHECK([fig2dev -L eps <<EOF | $SED -n '70,$ s/.*\((.*spaces)\).*/\1/p'
 FIG_FILE_TOP
@@ -620,6 +620,14 @@ EOF
 ])
 AT_CLEANUP
 
+AT_SETUP([reject text object with empty string, #195])
+AT_KEYWORDS([read.c])
+AT_CHECK([AS_ECHO_N(["FIG_FILE_TOP
+4 0 0 50 -1 4 20 0 4 330 1590 0 0"]) | fig2dev -L box], 1, ignore,
+[Incomplete text object at line 10.
+])
+AT_CLEANUP
+
 AT_BANNER([Dynamically allocate picture file name.])
 
 AT_SETUP([prepend fig file path to picture file name])