8000 Return error on unknown code · matplotlib/matplotlib@23e6cf5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23e6cf5

Browse files
committed
Return error on unknown code
1 parent cc41bff commit 23e6cf5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/_path.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ int __convert_to_string(PathIterator &path,
995995
while ((code = path.vertex(&x[0], &y[0])) != agg::path_cmd_stop) {
996996
if (code == 0x4f) {
997997
if ((p = __append_to_string(p, buffer, *buffersize, codes[4])) == NULL) return 1;
998-
} else {
998+
} else if (code < 5) {
999999
size = sizes[code - 1];
10001000

10011001
for (int i = 1; i < size; ++i) {
@@ -1052,6 +1052,9 @@ int __convert_to_string(PathIterator &path,
10521052

10531053
last_x = x[size - 1];
10541054
last_y = y[size - 1];
1055+
} else {
1056+
// Unknown code value
1057+
return 2;
10551058
}
10561059

10571060
if ((p = __append_to_string(p, buffer, *buffersize, "\n")) == NULL) return 1;

0 commit comments

Comments
 (0)
0