aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-12-20 11:03:13 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-12-20 11:03:13 +0100
commit6168e5812aeebe5fe2eaa0210c43d30d0aac9318 (patch)
tree21414d93f52b759e49b537ff956a30f92430a4f9
parent0edf7ebcd6703e3eb3b12bf0818796574d661ae3 (diff)
downloadffmpeg-6168e5812aeebe5fe2eaa0210c43d30d0aac9318.tar.gz
Fix off-by-one error when decoding rigth-to-left targa.
-rw-r--r--libavcodec/targa.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index f60524dc84..4ab560d960 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -238,18 +238,18 @@ static int decode_frame(AVCodecContext *avctx,
for(x = 0; x < s->width >> 1; x++){
switch(s->bpp){
case 32:
- FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[s->width - x]);
+ FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[s->width - x - 1]);
break;
case 24:
- FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * s->width - 3 * x ]);
- FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * s->width - 3 * x + 1]);
- FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * s->width - 3 * x + 2]);
+ FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * s->width - 3 * x - 3]);
+ FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * s->width - 3 * x - 2]);
+ FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * s->width - 3 * x - 1]);
break;
case 16:
- FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[s->width - x]);
+ FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[s->width - x - 1]);
break;
case 8:
- FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[s->width - x]);
+ FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[s->width - x - 1]);
}
}
}