static inline int loco_get_rice(RICEContext *r)
{
- int v;
+ unsigned v;
if (r->run > 0) { /* we have zero run */
r->run--;
loco_update_rice_param(r, 0);
int stride, const uint8_t *buf, int buf_size)
{
RICEContext rc;
- int val;
+ unsigned val;
int ret;
int i, j;
/* restore top line */
for (i = 1; i < width; i++) {
val = loco_get_rice(&rc);
+ if (val == INT_MIN)
+ return AVERROR_INVALIDDATA;
data[i] = data[i - 1] + val;
}
data += stride;
for (j = 1; j < height; j++) {
/* restore left column */
val = loco_get_rice(&rc);
+ if (val == INT_MIN)
+ return AVERROR_INVALIDDATA;
data[0] = data[-stride] + val;
/* restore all other pixels */
for (i = 1; i < width; i++) {
return 0;
}
-AVCodec ff_loco_decoder = {
+const AVCodec ff_loco_decoder = {
.name = "loco",
.long_name = NULL_IF_CONFIG_SMALL("LOCO"),
.type = AVMEDIA_TYPE_VIDEO,
.init = decode_init,
.decode = decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};