libtiff: fax2ps: fixes #475 buffer overflow in qsort function pcompar.

From 188e054164581521e7b1707bd36d1ceab0096980 Mon Sep 17 00:00:00 2001
From: Su_Laus <[EMAIL REDACTED]>
Date: Thu, 12 Jan 2023 21:51:44 +0100
Subject: [PATCH] fax2ps: fixes #475 buffer overflow in qsort function pcompar.

---
 tools/fax2ps.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/fax2ps.c b/tools/fax2ps.c
index 50245410..5f8fe557 100644
--- a/tools/fax2ps.c
+++ b/tools/fax2ps.c
@@ -332,9 +332,9 @@ void fax2ps(TIFF *tif, uint16_t npages, uint16_t *pages, char *filename)
 
 static int pcompar(const void *va, const void *vb)
 {
-    const int *pa = (const int *)va;
-    const int *pb = (const int *)vb;
-    return (*pa - *pb);
+    const uint16_t *pa = (const uint16_t *)va;
+    const uint16_t *pb = (const uint16_t *)vb;
+    return ((int32_t)*pa - (int32_t)*pb);
 }
 
 static void usage(int code);