vcl/source/fontsubset/sft.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 961089cba5123ce535fe859044ff4e93c257391a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Feb 20 19:50:35 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Feb 20 21:00:52 2023 +0000

    cid#1521192 Argument cannot be negative
    
    Change-Id: Ifd1b8c3391ed3576dfa61311c8bd46d1b284771e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147349
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9b9e4dfcb5b1..6644946699a4 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1082,7 +1082,8 @@ int CountTTCFonts(const char* fname)
     if (sscanf(fname, "/:FD:/%d%n", &nFD, &n) == 1 && fname[n] == '\0')
     {
         lseek(nFD, 0, SEEK_SET);
-        fd = fdopen(dup(nFD), "rb");
+        int nDupFd = dup(nFD);
+        fd = nDupFd != -1 ? fdopen(nDupFd, "rb") : nullptr;
     }
     else
 #endif

Reply via email to