mercurial/mpatch.c
branchstable
changeset 38194 59837a16896d
parent 38193 7f22ef3c0ee7
child 38195 9c5ced5276d6
equal deleted inserted replaced
38193:7f22ef3c0ee7 38194:59837a16896d
   283 	   left in the patch so we can read our three be32s out of it. */
   283 	   left in the patch so we can read our three be32s out of it. */
   284 	while (pos >= 0 && pos < (len - 11)) {
   284 	while (pos >= 0 && pos < (len - 11)) {
   285 		lt->start = getbe32(bin + pos);
   285 		lt->start = getbe32(bin + pos);
   286 		lt->end = getbe32(bin + pos + 4);
   286 		lt->end = getbe32(bin + pos + 4);
   287 		lt->len = getbe32(bin + pos + 8);
   287 		lt->len = getbe32(bin + pos + 8);
   288 		lt->data = bin + pos + 12;
   288 		if (lt->start < 0 || lt->start > lt->end || lt->len < 0)
   289 		pos += 12 + lt->len;
       
   290 		if (lt->start > lt->end || lt->len < 0)
       
   291 			break; /* sanity check */
   289 			break; /* sanity check */
       
   290 		if (!safeadd(12, &pos)) {
       
   291 			break;
       
   292 		}
       
   293 		lt->data = bin + pos;
       
   294 		if (!safeadd(lt->len, &pos)) {
       
   295 			break;
       
   296 		}
   292 		lt++;
   297 		lt++;
   293 	}
   298 	}
   294 
   299 
   295 	if (pos != len) {
   300 	if (pos != len) {
   296 		mpatch_lfree(l);
   301 		mpatch_lfree(l);