openbsd-ports/print/cups/patches/patch-pdftops_Catalog_cxx

32 lines
1.1 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-pdftops_Catalog_cxx,v 1.1.1.1 2005/01/16 12:36:51 mbalmer Exp $
--- pdftops/Catalog.cxx.orig Wed Oct 13 22:55:53 2004
+++ pdftops/Catalog.cxx Sat Dec 25 12:00:29 2004
@@ -13,6 +13,7 @@
#endif
#include <stddef.h>
+#include <sys/limits.h>
#include "gmem.h"
#include "Object.h"
#include "XRef.h"
@@ -64,8 +65,8 @@ Catalog::Catalog(XRef *xrefA) {
}
pagesSize = numPages0 = (int)obj.getNum();
obj.free();
- if (pagesSize*sizeof(Page *)/sizeof(Page *) != pagesSize ||
- pagesSize*sizeof(Ref)/sizeof(Ref) != pagesSize) {
+ if ((unsigned) pagesSize >= INT_MAX / sizeof(Page *) ||
+ (unsigned) pagesSize >= INT_MAX / sizeof(Ref)) {
error(-1, "Invalid 'pagesSize'");
ok = gFalse;
return;
@@ -197,7 +198,7 @@ int Catalog::readPageTree(Dict *pagesDic
}
if (start >= pagesSize) {
pagesSize += 32;
- if (pagesSize*sizeof(Page *)/sizeof(Page *) != pagesSize) {
+ if ((unsigned) pagesSize >= INT_MAX / sizeof(Page *)) {
error(-1, "Invalid 'pagesSize' parameter.");
goto err3;
}