##// END OF EJS Templates
bdiff: check and cast first parameter value on putbe32() calls...
Adrian Buehlmann -
r16750:5b1f869b default
parent child Browse files
Show More
@@ -381,9 +381,18 b' static PyObject *bdiff(PyObject *self, P'
381 for (h = l.next; h; h = h->next) {
381 for (h = l.next; h; h = h->next) {
382 if (h->a1 != la || h->b1 != lb) {
382 if (h->a1 != la || h->b1 != lb) {
383 len = bl[h->b1].l - bl[lb].l;
383 len = bl[h->b1].l - bl[lb].l;
384 putbe32(al[la].l - al->l, rb);
384
385 putbe32(al[h->a1].l - al->l, rb + 4);
385 #define checkputbe32(__x, __c) \
386 putbe32(len, rb + 8);
386 if (__x > UINT_MAX) { \
387 PyErr_SetString(PyExc_ValueError, \
388 "bdiff: value too large for putbe32"); \
389 goto nomem; \
390 } \
391 putbe32((uint32_t)(__x), __c);
392
393 checkputbe32(al[la].l - al->l, rb);
394 checkputbe32(al[h->a1].l - al->l, rb + 4);
395 checkputbe32(len, rb + 8);
387 memcpy(rb + 12, bl[lb].l, len);
396 memcpy(rb + 12, bl[lb].l, len);
388 rb += 12 + len;
397 rb += 12 + len;
389 }
398 }
General Comments 0
You need to be logged in to leave comments. Login now