[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64577] [grops] can't embed/download fonts from a subdirectory
From: |
G. Branden Robinson |
Subject: |
[bug #64577] [grops] can't embed/download fonts from a subdirectory |
Date: |
Mon, 21 Aug 2023 07:10:24 -0400 (EDT) |
Follow-up Comment #2, bug #64577 (project groff):
Proposed patch for diagnostic issue. Swept up related cases with it.
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 33fce911c..a8cdd2f11 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -788,8 +788,13 @@ void ps_printer::define_encoding(const char *encoding,
int encoding_index)
vec[i] = 0;
char *path;
FILE *fp = font::open_file(encoding, &path);
- if (fp == 0)
+ if (fp == 0) {
+ // If errno not valid, assume file rejected due to '/'.
+ if (errno <= 0)
+ fatal("refusing to traverse directories to open PostScript"
+ " encoding file '%1'");
fatal("can't open encoding file '%1'", encoding);
+ }
int lineno = 1;
const int BUFFER_SIZE = 512;
char buf[BUFFER_SIZE];
diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp
index 3c9a8b7b9..0c4dcc8ed 100644
--- a/src/devices/grops/psrm.cpp
+++ b/src/devices/grops/psrm.cpp
@@ -316,9 +316,14 @@ void resource_manager::output_prolog(ps_output &out)
}
char *prologue = getenv("GROPS_PROLOGUE");
FILE *fp = font::open_file(prologue, &path);
- if (!fp)
- fatal("failed to open PostScript prologue '%1': %2", prologue,
+ if (!fp) {
+ // If errno not valid, assume file rejected due to '/'.
+ if (errno <= 0)
+ fatal("refusing to traverse directories to open PostScript"
+ " prologue file '%1'");
+ fatal("failed to open PostScript prologue file '%1': %2", prologue,
strerror(errno));
+ }
fputs("%%BeginResource: ", outfp);
procset_resource->print_type_and_name(outfp);
putc('\n', outfp);
@@ -354,8 +359,13 @@ void resource_manager::supply_resource(resource *r, int
rank,
if (r->type == RESOURCE_FONT) {
fp = font::open_file(r->filename, &path);
if (!fp) {
- error("failed to open PostScript resource '%1': %2",
- r->filename, strerror(errno));
+ // If errno not valid, assume file rejected due to '/'.
+ if (errno <= 0)
+ error("refusing to traverse directories to open PostScript"
+ " resource file '%1'");
+ else
+ error("failed to open PostScript resource file '%1': %2",
+ r->filename, strerror(errno));
delete[] r->filename;
r->filename = 0 /* nullptr */;
}
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64577>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, G. Branden Robinson, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, G. Branden Robinson, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory,
G. Branden Robinson <=
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Phil Chadwick, 2023/08/21
- Message not available
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Deri James, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Dave, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Phil Chadwick, 2023/08/21
- Message not available
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Phil Chadwick, 2023/08/21
- Message not available
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Deri James, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Dave, 2023/08/21
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, G. Branden Robinson, 2023/08/22
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, Phil Chadwick, 2023/08/22
- Message not available
- [bug #64577] [grops] can't embed/download fonts from a subdirectory, G. Branden Robinson, 2023/08/23