handle arbitrary length names in subfontname.
handle overflow in offset computation in font.c
This commit is contained in:
parent
e354760aca
commit
d4aef6a074
2 changed files with 18 additions and 12 deletions
|
|
@ -177,7 +177,7 @@ int
|
|||
loadchar(Font *f, Rune r, Cacheinfo *c, int h, int noflush, char **subfontname)
|
||||
{
|
||||
int i, oi, wid, top, bottom;
|
||||
Rune pic;
|
||||
int pic; /* need >16 bits for adding offset below */
|
||||
Fontchar *fi;
|
||||
Cachefont *cf;
|
||||
Cachesubf *subf, *of;
|
||||
|
|
@ -270,10 +270,12 @@ loadchar(Font *f, Rune r, Cacheinfo *c, int h, int noflush, char **subfontname)
|
|||
Found2:
|
||||
subf->age = f->age;
|
||||
|
||||
/* possible overflow here, but works out okay */
|
||||
pic += cf->offset;
|
||||
if(pic-cf->min >= subf->f->n)
|
||||
pic -= cf->min;
|
||||
if(pic >= subf->f->n)
|
||||
goto TryPJW;
|
||||
fi = &subf->f->info[pic - cf->min];
|
||||
fi = &subf->f->info[pic];
|
||||
if(fi->width == 0)
|
||||
goto TryPJW;
|
||||
wid = (fi+1)->x - fi->x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue