~pythonregexp2.7/python/issue2636-09-01+10

« back to all changes in this revision

Viewing changes to Modules/md5.c

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-09-22 21:39:45 UTC
  • mfrom: (39055.1.33 Regexp-2.7)
  • Revision ID: darklord@timehorse.com-20080922213945-23717m5eiqpamcyn
Merged in changes from the Single-Loop Engine branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
#include "md5.h"
55
55
#include <string.h>
 
56
#include <limits.h>
56
57
 
57
58
#undef BYTE_ORDER       /* 1 = big-endian, -1 = little-endian, 0 = unknown */
58
59
#ifdef ARCH_IS_BIG_ENDIAN
330
331
    if (nbytes <= 0)
331
332
        return;
332
333
 
 
334
    /* this special case is handled recursively */
 
335
    if (nbytes > INT_MAX - offset) {
 
336
        int overlap;
 
337
 
 
338
        /* handle the append in two steps to prevent overflow */
 
339
        overlap = 64 - offset;
 
340
 
 
341
        md5_append(pms, data, overlap);
 
342
        md5_append(pms, data + overlap, nbytes - overlap); 
 
343
        return;
 
344
    }
 
345
 
333
346
    /* Update the message length. */
334
347
    pms->count[1] += nbytes >> 29;
335
348
    pms->count[0] += nbits;