diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-16 23:26:44 +0100 |
---|---|---|
committer | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2020-12-16 23:26:44 +0100 |
commit | ca8b1996e80bc82ce2b14cb955dbc79dc30e1086 (patch) | |
tree | 01ea6e6889d190dc30f972e046e5f0948b66f4e5 | |
parent | 6676dc51345b5a4a7005ebd6bfe25486fcf7b4a8 (diff) |
fix(buchstabensuppe): check if font is regular file
This avoids stb_truetype crashing.
-rw-r--r-- | buchstabensuppe.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/buchstabensuppe.c b/buchstabensuppe.c index f5f4605..ec9b211 100644 --- a/buchstabensuppe.c +++ b/buchstabensuppe.c @@ -50,6 +50,11 @@ bool bs_add_font(bs_context_t *ctx, const char *font_path, int font_index, unsig return false; } + if(!S_ISREG(finfo.st_mode)) { + LOG("Error: not a regular file %s", font_path); + return false; + } + size_t file_buffer_size = finfo.st_size; unsigned char *file_buffer = malloc(sizeof(unsigned char) * file_buffer_size); |