summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/acme/dat.h4
-rw-r--r--sys/src/cmd/acme/disk.c3
-rw-r--r--sys/src/cmd/sam/disk.c3
-rw-r--r--sys/src/cmd/sam/sam.h2
4 files changed, 9 insertions, 3 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;
diff --git a/sys/src/cmd/sam/disk.c b/sys/src/cmd/sam/disk.c
index 47b30bda4..e822f4811 100644
--- a/sys/src/cmd/sam/disk.c
+++ b/sys/src/cmd/sam/disk.c
@@ -71,6 +71,9 @@ disknewblock(Disk *d, uint n)
b = blist;
blist = b->next;
b->addr = d->addr;
+ if(d->addr+size < d->addr){
+ panic("temp file overflow");
+ }
d->addr += size;
}
b->n = n;
diff --git a/sys/src/cmd/sam/sam.h b/sys/src/cmd/sam/sam.h
index f1cbd8ac0..f99fdae46 100644
--- a/sys/src/cmd/sam/sam.h
+++ b/sys/src/cmd/sam/sam.h
@@ -117,7 +117,7 @@ struct Block
struct Disk
{
int fd;
- uint addr; /* length of temp file */
+ vlong addr; /* length of temp file */
Block *free[Maxblock/Blockincr+1];
};