mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-17 12:51:36 +00:00
tiff: Make the TIFF_LONG and TIFF_SHORT types unsigned.
TIFF v6.0 (unimplemented) adds signed equivalents.
This commit is contained in:
parent
14c98973f5
commit
e32548d133
@ -59,24 +59,24 @@ typedef struct TiffContext {
|
|||||||
LZWState *lzw;
|
LZWState *lzw;
|
||||||
} TiffContext;
|
} TiffContext;
|
||||||
|
|
||||||
static int tget_short(const uint8_t **p, int le){
|
static unsigned tget_short(const uint8_t **p, int le) {
|
||||||
int v = le ? AV_RL16(*p) : AV_RB16(*p);
|
unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
|
||||||
*p += 2;
|
*p += 2;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tget_long(const uint8_t **p, int le){
|
static unsigned tget_long(const uint8_t **p, int le) {
|
||||||
int v = le ? AV_RL32(*p) : AV_RB32(*p);
|
unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
|
||||||
*p += 4;
|
*p += 4;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tget(const uint8_t **p, int type, int le){
|
static unsigned tget(const uint8_t **p, int type, int le) {
|
||||||
switch(type){
|
switch(type){
|
||||||
case TIFF_BYTE : return *(*p)++;
|
case TIFF_BYTE : return *(*p)++;
|
||||||
case TIFF_SHORT: return tget_short(p, le);
|
case TIFF_SHORT: return tget_short(p, le);
|
||||||
case TIFF_LONG : return tget_long (p, le);
|
case TIFF_LONG : return tget_long (p, le);
|
||||||
default : return -1;
|
default : return UINT_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ static int init_image(TiffContext *s)
|
|||||||
|
|
||||||
static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
|
static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
|
||||||
{
|
{
|
||||||
int tag, type, count, off, value = 0;
|
unsigned tag, type, count, off, value = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
uint32_t *pal;
|
uint32_t *pal;
|
||||||
const uint8_t *rp, *gp, *bp;
|
const uint8_t *rp, *gp, *bp;
|
||||||
@ -307,7 +307,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
value = -1;
|
value = UINT_MAX;
|
||||||
buf = start + off;
|
buf = start + off;
|
||||||
}
|
}
|
||||||
}else if(type_sizes[type] * count <= 4){
|
}else if(type_sizes[type] * count <= 4){
|
||||||
@ -391,7 +391,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_ROWSPERSTRIP:
|
case TIFF_ROWSPERSTRIP:
|
||||||
if(type == TIFF_LONG && value == -1)
|
if (type == TIFF_LONG && value == UINT_MAX)
|
||||||
value = s->avctx->height;
|
value = s->avctx->height;
|
||||||
if(value < 1){
|
if(value < 1){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user