Ignore:
Timestamp:
Sep 7, 2012, 8:38:55 AM (9 years ago)
Author:
Silvan Scherrer
Message:

updated poppler to 0.20.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/poppler/mypoppler/fofi/FoFiBase.cc

    r497 r515  
    2929
    3030#include <stdio.h>
     31#include <limits.h>
    3132#include "goo/gmem.h"
    3233#include "poppler/Error.h"
     
    5556
    5657  if (!(f = fopen(fileName, "rb"))) {
    57     error(-1, "Cannot open '%s'", fileName);
     58    error(errIO, -1, "Cannot open '{0:s}'", fileName);
    5859    return NULL;
    5960  }
    6061  if (fseek(f, 0, SEEK_END) != 0) {
    61     error(-1, "Cannot seek to end of '%s'", fileName);
     62    error(errIO, -1, "Cannot seek to end of '{0:s}'", fileName);
    6263    fclose(f);
    6364    return NULL;
     
    6566  n = (int)ftell(f);
    6667  if (n < 0) {
    67     error(-1, "Cannot determine length of '%s'", fileName);
     68    error(errIO, -1, "Cannot determine length of '{0:s}'", fileName);
    6869    fclose(f);
    6970    return NULL;
    7071  }
    7172  if (fseek(f, 0, SEEK_SET) != 0) {
    72     error(-1, "Cannot seek to start of '%s'", fileName);
     73    error(errIO, -1, "Cannot seek to start of '{0:s}'", fileName);
    7374    fclose(f);
    7475    return NULL;
     
    110111  int x;
    111112
    112   if (pos < 0 || pos+1 >= len) {
     113  if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) {
    113114    *ok = gFalse;
    114115    return 0;
     
    125126  int x;
    126127
    127   if (pos < 0 || pos+1 >= len) {
     128  if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) {
    128129    *ok = gFalse;
    129130    return 0;
     
    137138  int x;
    138139
    139   if (pos < 0 || pos+3 >= len) {
     140  if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
    140141    *ok = gFalse;
    141142    return 0;
     
    154155  Guint x;
    155156
    156   if (pos < 0 || pos+3 >= len) {
     157  if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
    157158    *ok = gFalse;
    158159    return 0;
     
    162163  x = (x << 8) + file[pos+2];
    163164  x = (x << 8) + file[pos+3];
     165  return x;
     166}
     167
     168Guint FoFiBase::getU32LE(int pos, GBool *ok) {
     169  Guint x;
     170
     171  if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
     172    *ok = gFalse;
     173    return 0;
     174  }
     175  x = file[pos+3];
     176  x = (x << 8) + file[pos+2];
     177  x = (x << 8) + file[pos+1];
     178  x = (x << 8) + file[pos];
    164179  return x;
    165180}
     
    169184  int i;
    170185
    171   if (pos < 0 || pos + size > len) {
     186  if (pos < 0 || pos + size > len || pos > INT_MAX - size) {
    172187    *ok = gFalse;
    173188    return 0;
Note: See TracChangeset for help on using the changeset viewer.