summaryrefslogtreecommitdiff
path: root/sys/src/cmd/acme
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-12-04 11:46:42 -0800
committerOri Bernstein <ori@eigenstate.org>2019-12-04 11:46:42 -0800
commita181f3dd3e922e7acc5a3f4982584e845bddec3c (patch)
treeb59c712d25792d29325d2d9507541fb55f22d9f6 /sys/src/cmd/acme
parentf7db45e62852ba716539247e20eaaa027b5b1c67 (diff)
acme, sam: handle >1GB files correctly
imported from plan9port, edfe3c016fe6ef10c55f7a17aab668214ec21efc
Diffstat (limited to 'sys/src/cmd/acme')
-rw-r--r--sys/src/cmd/acme/dat.h4
-rw-r--r--sys/src/cmd/acme/disk.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/cmd/acme/dat.h b/sys/src/cmd/acme/dat.h
index 070be119b..bfc16e913 100644
--- a/sys/src/cmd/acme/dat.h
+++ b/sys/src/cmd/acme/dat.h
@@ -68,7 +68,7 @@ struct Range
struct Block
{
- uint addr; /* disk address in bytes */
+ vlong addr; /* disk address in bytes */
union
{
uint n; /* number of used runes in block */
@@ -79,7 +79,7 @@ struct Block
struct Disk
{
int fd;
- uint addr; /* length of temp file */
+ vlong addr; /* length of temp file */
Block *free[Maxblock/Blockincr+1];
};
diff --git a/sys/src/cmd/acme/disk.c b/sys/src/cmd/acme/disk.c
index 9b76a5582..8eb461a49 100644
--- a/sys/src/cmd/acme/disk.c
+++ b/sys/src/cmd/acme/disk.c
@@ -82,6 +82,9 @@ disknewblock(Disk *d, uint n)
b = blist;
blist = b->next;
b->addr = d->addr;
+ if(d->addr+size < d->addr){
+ error("temp file overflow");
+ }
d->addr += size;
}
b->n = n;