Fix multiplication overflow and fgetc usage to avoid Coverity errors.
{
FILE *driver = NULL;
const char *curMatch;
- char curFileChar;
+ int curFileChar;
int i;
g_debug("%s: Scanning for VMWare Xorg drivers.\n", __func__);
goto outNotFound;
curFileChar = fgetc(driver);
- if (curFileChar == *curMatch) {
+ if (curFileChar != EOF && curFileChar == *curMatch) {
curMatch++;
continue;
} else if (curMatch != versionString) {
* and height.
*/
for (i = 0; i < xrrNumSizes; i++) {
- potentialSize = xrrSizes[i].width * xrrSizes[i].height;
+ potentialSize = (uint64)xrrSizes[i].width * xrrSizes[i].height;
if (xrrSizes[i].width <= width && xrrSizes[i].height <= height &&
potentialSize > bestFitSize ) {
bestFitSize = potentialSize;