ref: 55b89c19827641bd05156fb5a3869d8448e397be
parent: 23992f867fce5f0bfd2170137f31816326c7a31f
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Sep 25 20:00:00 EDT 2020
pack: clean up debug prints.
--- a/pack.c
+++ b/pack.c
@@ -347,7 +347,10 @@
r += l;
/* inline data */
}else{
- assert(c <= ed - d);
+ if(c > ed - d){
+ werrstr("garbled delta: write past object");
+ return -1;
+ }
memmove(r, d, c);
d += c;
r += c;
@@ -1467,7 +1470,7 @@
}
static int
-packoff(char *hdr, int off)
+packoff(char *hdr, vlong off)
{
int i;
@@ -1532,14 +1535,6 @@
nh = 0;
nh += packhdr(buf, GOdelta, nd);
nh += packoff(buf+nh, m->off - m->prev->off);
-#ifdef NOPE
- print("Odelta %d %lld\n\t", nd, m->off - m->prev->off);
- for(int j = 0; j < nh; j++)
- print("%02x:", buf[j] & 0xff);
- print("\n");
- if(m->off == 444541)
- abort();
-#endif
hwrite(bfd, buf, nh, &st);
}else{
nh = packhdr(buf, GRdelta, nd);