mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mjpegdec: fix endiansoup
Fixes Ticket2175 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
6091a8d92d
commit
03bc7a004e
@ -1356,7 +1356,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
id = get_bits_long(&s->gb, 32);
|
id = get_bits_long(&s->gb, 32);
|
||||||
id = av_be2ne32(id);
|
|
||||||
len -= 6;
|
len -= 6;
|
||||||
|
|
||||||
if (s->avctx->debug & FF_DEBUG_STARTCODE)
|
if (s->avctx->debug & FF_DEBUG_STARTCODE)
|
||||||
@ -1365,7 +1364,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
/* Buggy AVID, it puts EOI only at every 10th frame. */
|
/* Buggy AVID, it puts EOI only at every 10th frame. */
|
||||||
/* Also, this fourcc is used by non-avid files too, it holds some
|
/* Also, this fourcc is used by non-avid files too, it holds some
|
||||||
information, but it's always present in AVID-created files. */
|
information, but it's always present in AVID-created files. */
|
||||||
if (id == AV_RL32("AVI1")) {
|
if (id == AV_RB32("AVI1")) {
|
||||||
/* structure:
|
/* structure:
|
||||||
4bytes AVI1
|
4bytes AVI1
|
||||||
1bytes polarity
|
1bytes polarity
|
||||||
@ -1387,7 +1386,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
|
|
||||||
// len -= 2;
|
// len -= 2;
|
||||||
|
|
||||||
if (id == AV_RL32("JFIF")) {
|
if (id == AV_RB32("JFIF")) {
|
||||||
int t_w, t_h, v1, v2;
|
int t_w, t_h, v1, v2;
|
||||||
skip_bits(&s->gb, 8); /* the trailing zero-byte */
|
skip_bits(&s->gb, 8); /* the trailing zero-byte */
|
||||||
v1 = get_bits(&s->gb, 8);
|
v1 = get_bits(&s->gb, 8);
|
||||||
@ -1415,7 +1414,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e')) {
|
if (id == AV_RB32("Adob") && (get_bits(&s->gb, 8) == 'e')) {
|
||||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||||
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
|
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
|
||||||
skip_bits(&s->gb, 16); /* version */
|
skip_bits(&s->gb, 16); /* version */
|
||||||
@ -1426,7 +1425,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == AV_RL32("LJIF")) {
|
if (id == AV_RB32("LJIF")) {
|
||||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||||
av_log(s->avctx, AV_LOG_INFO,
|
av_log(s->avctx, AV_LOG_INFO,
|
||||||
"Pegasus lossless jpeg header found\n");
|
"Pegasus lossless jpeg header found\n");
|
||||||
@ -1453,10 +1452,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
|||||||
/* Apple MJPEG-A */
|
/* Apple MJPEG-A */
|
||||||
if ((s->start_code == APP1) && (len > (0x28 - 8))) {
|
if ((s->start_code == APP1) && (len > (0x28 - 8))) {
|
||||||
id = get_bits_long(&s->gb, 32);
|
id = get_bits_long(&s->gb, 32);
|
||||||
id = av_be2ne32(id);
|
|
||||||
len -= 4;
|
len -= 4;
|
||||||
/* Apple MJPEG-A */
|
/* Apple MJPEG-A */
|
||||||
if (id == AV_RL32("mjpg")) {
|
if (id == AV_RB32("mjpg")) {
|
||||||
#if 0
|
#if 0
|
||||||
skip_bits(&s->gb, 32); /* field size */
|
skip_bits(&s->gb, 32); /* field size */
|
||||||
skip_bits(&s->gb, 32); /* pad field size */
|
skip_bits(&s->gb, 32); /* pad field size */
|
||||||
|
Loading…
Reference in New Issue
Block a user