diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/imageviewer/jpeg/jpeg_decoder.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/plugins/imageviewer/jpeg/jpeg_decoder.c b/apps/plugins/imageviewer/jpeg/jpeg_decoder.c index 0adff53788..342b59c6a4 100644 --- a/apps/plugins/imageviewer/jpeg/jpeg_decoder.c +++ b/apps/plugins/imageviewer/jpeg/jpeg_decoder.c | |||
@@ -507,29 +507,27 @@ static void idct8x8(unsigned char* p_byte, int* inptr, int* quantptr, int skip_l | |||
507 | /* Preprocess the JPEG JFIF file */ | 507 | /* Preprocess the JPEG JFIF file */ |
508 | int process_markers(unsigned char* p_src, long size, struct jpeg* p_jpeg) | 508 | int process_markers(unsigned char* p_src, long size, struct jpeg* p_jpeg) |
509 | { | 509 | { |
510 | unsigned char* p_bytes = p_src; | 510 | unsigned char* p_end = p_src + size; |
511 | int marker_size; /* variable length of marker segment */ | 511 | int marker_size; /* variable length of marker segment */ |
512 | int i, j, n; | 512 | int i, j, n; |
513 | int ret = 0; /* returned flags */ | 513 | int ret = 0; /* returned flags */ |
514 | 514 | ||
515 | p_jpeg->p_entropy_end = p_src + size; | 515 | p_jpeg->p_entropy_end = p_end; |
516 | 516 | ||
517 | while (p_src < p_bytes + size) | 517 | while (p_src < p_end) |
518 | { | 518 | { |
519 | if (*p_src++ != 0xFF) /* no marker? */ | 519 | if (*p_src++ != 0xFF) /* no marker? */ |
520 | { | 520 | { |
521 | p_src--; /* it's image data, put it back */ | 521 | continue; /* discard */ |
522 | p_jpeg->p_entropy_data = p_src; | ||
523 | break; /* exit marker processing */ | ||
524 | } | 522 | } |
525 | 523 | ||
526 | switch (*p_src++) | 524 | switch (*p_src++) |
527 | { | 525 | { |
528 | case 0xFF: /* Fill byte */ | 526 | case 0xFF: /* Previous FF was fill byte */ |
529 | ret |= FILL_FF; | 527 | p_src--; /* This FF could be start of a marker */ |
530 | case 0x00: /* Zero stuffed byte - entropy data */ | ||
531 | p_src--; /* put it back */ | ||
532 | continue; | 528 | continue; |
529 | case 0x00: /* Zero stuffed byte - discard */ | ||
530 | break; | ||
533 | 531 | ||
534 | case 0xC0: /* SOF Huff - Baseline DCT */ | 532 | case 0xC0: /* SOF Huff - Baseline DCT */ |
535 | { | 533 | { |
@@ -657,6 +655,8 @@ int process_markers(unsigned char* p_src, long size, struct jpeg* p_jpeg) | |||
657 | p_jpeg->scanheader[i].AC_select = *p_src++ & 0x0F; | 655 | p_jpeg->scanheader[i].AC_select = *p_src++ & 0x0F; |
658 | } | 656 | } |
659 | p_src += 3; /* skip spectral information */ | 657 | p_src += 3; /* skip spectral information */ |
658 | p_jpeg->p_entropy_data = p_src; | ||
659 | p_end = p_src; /* exit while loop */ | ||
660 | } | 660 | } |
661 | break; | 661 | break; |
662 | 662 | ||