Ignore:
Timestamp:
Dec 30, 2009, 7:13:45 PM (12 years ago)
Author:
rbri
Message:

PDF plugin: Poppler library updated to version 0.12.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/poppler/mypoppler/poppler/Lexer.cc

    r257 r277  
    1414// under GPL version 2 or later
    1515//
    16 // Copyright (C) 2006-2008 Albert Astals Cid <aacid@kde.org>
     16// Copyright (C) 2006-2009 Albert Astals Cid <aacid@kde.org>
    1717// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
    1818//
     
    3131#include <stddef.h>
    3232#include <string.h>
     33#include <limits.h>
    3334#include <ctype.h>
    3435#include "Lexer.h"
     
    5960};
    6061
     62static const int IntegerSafeLimit = (INT_MAX - 9) / 10;
     63
    6164//------------------------------------------------------------------------
    6265// Lexer
     
    151154  char *p;
    152155  int c, c2;
    153   GBool comment, neg, done;
     156  GBool comment, neg, done, overflownInteger;
    154157  int numParen;
    155158  int xi;
     
    181184  case '5': case '6': case '7': case '8': case '9':
    182185  case '-': case '.':
     186    overflownInteger = gFalse;
    183187    neg = gFalse;
    184188    xi = 0;
     
    194198      if (isdigit(c)) {
    195199        getChar();
    196         xi = xi * 10 + (c - '0');
     200        if (unlikely(overflownInteger)) {
     201          xf = xf * 10.0 + (c - '0');
     202        } else {
     203          if (unlikely(xi > IntegerSafeLimit) &&
     204              (xi > (INT_MAX - (c - '0')) / 10.0)) {
     205            overflownInteger = gTrue;
     206            xf = xi * 10.0 + (c - '0');
     207          } else {
     208            xi = xi * 10 + (c - '0');
     209          }
     210        }
    197211      } else if (c == '.') {
    198212        getChar();
     
    204218    if (neg)
    205219      xi = -xi;
    206     obj->initInt(xi);
     220    if (unlikely(overflownInteger)) {
     221      obj->initError();
     222    } else {
     223      obj->initInt(xi);
     224    }
    207225    break;
    208226  doReal:
    209     xf = xi;
     227    if (likely(!overflownInteger)) {
     228      xf = xi;
     229    }
    210230    scale = 0.1;
    211231    while (1) {
Note: See TracChangeset for help on using the changeset viewer.