Commit 8a7a6686 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Remove warnings caused by the overflow checks. Aprroved by Dirk Mueller from security team

svn path=/trunk/kdegraphics/kpdf/; revision=356973
parent 60841da9
......@@ -66,8 +66,8 @@ Catalog::Catalog(XRef *xrefA) {
obj.free();
// The gcc doesnt optimize this away, so this check is ok,
// even if it looks like a pagesSize != pagesSize check
if (pagesSize*sizeof(Page *)/sizeof(Page *) != pagesSize ||
pagesSize*sizeof(Ref)/sizeof(Ref) != pagesSize) {
if (pagesSize*sizeof(Page *)/sizeof(Page *) != (unsigned int)pagesSize ||
pagesSize*sizeof(Ref)/sizeof(Ref) != (unsigned int)pagesSize) {
error(-1, "Invalid 'pagesSize'");
ok = gFalse;
return;
......@@ -200,8 +200,8 @@ int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start) {
}
if (start >= pagesSize) {
pagesSize += 32;
if (pagesSize*sizeof(Page *)/sizeof(Page *) != pagesSize ||
pagesSize*sizeof(Ref)/sizeof(Ref) != pagesSize) {
if (pagesSize*sizeof(Page *)/sizeof(Page *) != (unsigned int)pagesSize ||
pagesSize*sizeof(Ref)/sizeof(Ref) != (unsigned int)pagesSize) {
error(-1, "Invalid 'pagesSize' parameter.");
goto err3;
}
......
......@@ -110,7 +110,7 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
goto err1;
}
if (nObjects*sizeof(int)/sizeof(int) != nObjects) {
if (nObjects*sizeof(int)/sizeof(int) != (uint)nObjects) {
error(-1, "Invalid 'nObjects'");
goto err1;
}
......@@ -393,7 +393,7 @@ GBool XRef::readXRefTable(Parser *parser, Guint *pos) {
if (newSize < 0) {
goto err1;
}
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != (uint)newSize) {
error(-1, "Invalid 'obj' parameters'");
goto err1;
}
......@@ -503,7 +503,7 @@ GBool XRef::readXRefStream(Stream *xrefStr, Guint *pos) {
goto err1;
}
if (newSize > size) {
if (newSize * sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
if (newSize * sizeof(XRefEntry)/sizeof(XRefEntry) != (uint)newSize) {
error(-1, "Invalid 'size' parameter.");
return gFalse;
}
......@@ -597,7 +597,7 @@ GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) {
if (newSize < 0) {
return gFalse;
}
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != (uint)newSize) {
error(-1, "Invalid 'size' inside xref table.");
return gFalse;
}
......@@ -736,7 +736,7 @@ GBool XRef::constructXRef() {
error(-1, "Bad object number");
return gFalse;
}
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != newSize) {
if (newSize*sizeof(XRefEntry)/sizeof(XRefEntry) != (uint)newSize) {
error(-1, "Invalid 'obj' parameters.");
return gFalse;
}
......@@ -763,7 +763,7 @@ GBool XRef::constructXRef() {
} else if (!strncmp(p, "endstream", 9)) {
if (streamEndsLen == streamEndsSize) {
streamEndsSize += 64;
if (streamEndsSize*sizeof(int)/sizeof(int) != streamEndsSize) {
if (streamEndsSize*sizeof(int)/sizeof(int) != (uint)streamEndsSize) {
error(-1, "Invalid 'endstream' parameter.");
return gFalse;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment