summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2007-01-21 21:04:11 +0000
committerdotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2007-01-21 21:04:11 +0000
commit8f66aff36a341906552a4bf7792b872fc3e2d338 (patch)
treefca7441366936a5c99a488796355517cdd9e11b7
parent46bc79f71df9953b6b3c8c079f4621054bec44e8 (diff)
Fixes dumb crash in xd3_free_stream when stream->iopt_alloc is NULL.
-rwxr-xr-xxdelta3/setup.py1
-rwxr-xr-xxdelta3/xdelta3-regtest.py19
-rwxr-xr-xxdelta3/xdelta3.c6
3 files changed, 14 insertions, 12 deletions
diff --git a/xdelta3/setup.py b/xdelta3/setup.py
index 75c6f91..f1857a9 100755
--- a/xdelta3/setup.py
+++ b/xdelta3/setup.py
@@ -32,6 +32,7 @@ xdelta3_ext = Extension('xdelta3',
32 ('PYTHON_MODULE',1), 32 ('PYTHON_MODULE',1),
33 ], 33 ],
34 extra_compile_args = [ '-O3', 34 extra_compile_args = [ '-O3',
35 '-g',
35 '-funroll-loops', 36 '-funroll-loops',
36 ]) 37 ])
37 38
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index bf064bb..8a7e62c 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -46,7 +46,7 @@ MAX_RUN = 1000 * 1000 * 10
46 46
47# 47#
48# 48#
49RCSDIR = '/mnt/polaroid/Polaroid/orbit_linux/home/jmacd/PRCS/prcs/b' 49RCSDIR = '/mnt/polaroid/Polaroid/orbit_linux/home/jmacd/PRCS'
50 50
51TMPDIR = '/tmp/xd3regtest.%d' % os.getpid() 51TMPDIR = '/tmp/xd3regtest.%d' % os.getpid()
52 52
@@ -578,6 +578,7 @@ def MakeBigFiles(rcsf):
578 f1sz += file.AppendVersion(f1, r1) 578 f1sz += file.AppendVersion(f1, r1)
579 f2sz += file.AppendVersion(f2, r2) 579 f2sz += file.AppendVersion(f2, r2)
580 580
581 print 'from %u; to %u' % (f1sz, f2sz)
581 f1.close() 582 f1.close()
582 f2.close() 583 f2.close()
583 return (TMPDIR + "/big.1", 584 return (TMPDIR + "/big.1",
@@ -588,10 +589,10 @@ def BigFileRun(f1, f2):
588 testcases = [ 589 testcases = [
589 # large_look large_step small_look small_chain small_lchain 590 # large_look large_step small_look small_chain small_lchain
590 # ssmatch try_lazy max_lazy long_enough promote 591 # ssmatch try_lazy max_lazy long_enough promote
591 ['-DC', '9,7,4,8,1,1,1,16,114,0'], 592 ['-DC', '10,1,5,18,13,1,1,127,83,0'],
592 ['-DC', '9,6,4,8,1,1,1,16,114,0'], 593 ['-DC', '10,1,5,18,13,1,1,127,83,1'],
593 ['-DC', '9,5,4,8,1,1,1,16,114,0'], 594 ['-DC', '10,1,4,18,13,1,1,127,83,0'],
594 ['-DC', '9,4,4,8,1,1,1,16,114,0'], 595 ['-DC', '10,1,4,18,13,1,1,127,83,1'],
595 ] 596 ]
596 597
597 for test in testcases: 598 for test in testcases:
@@ -642,7 +643,7 @@ def RandomBigRun(f1, f2):
642 strs = [str(x) for x in config] 643 strs = [str(x) for x in config]
643 644
644 runner = Xdelta3Pair() 645 runner = Xdelta3Pair()
645 runner.extra = ['-DC', ','.join(strs)] 646 runner.extra = ['-I', '0', '-D', '-C', ','.join(strs)]
646 result = TimeRun(runner.Runner(f1, 1, f2, 2)) 647 result = TimeRun(runner.Runner(f1, 1, f2, 2))
647 648
648 print 'config %s dsize %d time %.7f in %u trials' % \ 649 print 'config %s dsize %d time %.7f in %u trials' % \
@@ -664,12 +665,14 @@ def RunSpeed():
664if __name__ == "__main__": 665if __name__ == "__main__":
665 try: 666 try:
666 os.mkdir(TMPDIR) 667 os.mkdir(TMPDIR)
667 #rcsf = Test() 668 rcsf = Test()
668 #rcsf.PairsByDate(Xdelta3Pair()) 669 #rcsf.PairsByDate(Xdelta3Pair())
669 #RunSpeed() 670 #RunSpeed()
670 while 1: 671 while 1:
671 try: 672 try:
672 RandomBigRun("/tmp/big.1", "/tmp/big.2") 673 f1, f2 = MakeBigFiles(rcsf)
674 #RandomBigRun("/tmp/big.1", "/tmp/big.2")
675 BigFileRun(f1, f2)
673 except CommandError, e: 676 except CommandError, e:
674 pass 677 pass
675 #end 678 #end
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 97c3390..4c750ab 100755
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -2283,14 +2283,13 @@ xd3_free_stream (xd3_stream *stream)
2283{ 2283{
2284 xd3_iopt_buflist *blist = stream->iopt_alloc; 2284 xd3_iopt_buflist *blist = stream->iopt_alloc;
2285 2285
2286 do 2286 while (blist != NULL)
2287 { 2287 {
2288 xd3_iopt_buflist *tmp = blist; 2288 xd3_iopt_buflist *tmp = blist;
2289 blist = blist->next; 2289 blist = blist->next;
2290 xd3_free (stream, tmp->buffer); 2290 xd3_free (stream, tmp->buffer);
2291 xd3_free (stream, tmp); 2291 xd3_free (stream, tmp);
2292 } 2292 }
2293 while (blist != NULL);
2294 2293
2295 xd3_free (stream, stream->large_table); 2294 xd3_free (stream, stream->large_table);
2296 xd3_free (stream, stream->small_table); 2295 xd3_free (stream, stream->small_table);
@@ -3465,7 +3464,6 @@ static int
3465xd3_alloc_iopt (xd3_stream *stream, int elts) 3464xd3_alloc_iopt (xd3_stream *stream, int elts)
3466{ 3465{
3467 int i; 3466 int i;
3468 xd3_iopt_buflist* next = stream->iopt_alloc;
3469 xd3_iopt_buflist* last = xd3_alloc (stream, sizeof (xd3_iopt_buflist), 1); 3467 xd3_iopt_buflist* last = xd3_alloc (stream, sizeof (xd3_iopt_buflist), 1);
3470 3468
3471 if (last == NULL || 3469 if (last == NULL ||
@@ -3474,7 +3472,7 @@ xd3_alloc_iopt (xd3_stream *stream, int elts)
3474 return ENOMEM; 3472 return ENOMEM;
3475 } 3473 }
3476 3474
3477 last->next = next; 3475 last->next = stream->iopt_alloc;
3478 stream->iopt_alloc = last; 3476 stream->iopt_alloc = last;
3479 3477
3480 for (i = 0; i < elts; i += 1) 3478 for (i = 0; i < elts; i += 1)