- Timestamp:
- Jun 29, 2014, 7:35:55 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/minilzo.c
r1 r455 2399 2399 # endif 2400 2400 # if (LZO_TEST_DECOMPRESS_OVERRUN_INPUT >= 2) 2401 # define NEED_IP(x ) \2402 if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun2401 # define NEED_IP(x, y) \ 2402 if ( ((y > 0) && (x > (LZO_UINT_MAX - y))) || ((lzo_uint)(ip_end - ip) < (lzo_uint)((x)+(y))) ) goto input_overrun 2403 2403 # endif 2404 2404 #endif … … 2410 2410 # if (LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT >= 2) 2411 2411 # undef TEST_OP 2412 # define NEED_OP(x ) \2413 if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun2412 # define NEED_OP(x,y) \ 2413 if ( ((y > 0) && (x > (LZO_UINT_MAX - y))) || ((lzo_uint)(op_end - op) < (lzo_uint)((x)+(y))) ) goto output_overrun 2414 2414 # endif 2415 2415 #endif … … 2439 2439 # define HAVE_NEED_IP 2440 2440 #else 2441 # define NEED_IP(x) ((void) 0) 2441 /* # define NEED_IP(x) ((void) 0) */ 2442 #error "no need_ip" 2442 2443 #endif 2443 2444 #if defined(NEED_OP) 2444 2445 # define HAVE_NEED_OP 2445 2446 #else 2446 # define NEED_OP(x) ((void) 0) 2447 /* # define NEED_OP(x) ((void) 0) */ 2448 #error "no need_op" 2447 2449 #endif 2448 2450 … … 2513 2515 if (t < 4) 2514 2516 goto match_next; 2515 assert(t > 0); NEED_OP(t ); NEED_IP(t+1);2517 assert(t > 0); NEED_OP(t, 0); NEED_IP(t, 1); 2516 2518 do *op++ = *ip++; while (--t > 0); 2517 2519 goto first_literal_run; … … 2525 2527 if (t == 0) 2526 2528 { 2527 NEED_IP(1);2529 NEED_IP(1, 0); 2528 2530 while (*ip == 0) 2529 2531 { 2530 2532 t += 255; 2531 2533 ip++; 2532 NEED_IP(1 );2534 NEED_IP(1, 0); 2533 2535 } 2534 2536 t += 15 + *ip++; 2535 2537 } 2536 assert(t > 0); NEED_OP(t +3); NEED_IP(t+4);2538 assert(t > 0); NEED_OP(t,3); NEED_IP(t,4); 2537 2539 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2538 2540 #if !defined(LZO_UNALIGNED_OK_4) … … 2591 2593 m_pos -= *ip++ << 2; 2592 2594 #endif 2593 TEST_LOOKBEHIND(m_pos,out); NEED_OP(3 );2595 TEST_LOOKBEHIND(m_pos,out); NEED_OP(3,0); 2594 2596 *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; 2595 2597 #endif … … 2648 2650 t = (t >> 5) - 1; 2649 2651 #endif 2650 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t +3-1);2652 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t,(3-1)); 2651 2653 goto copy_match; 2652 2654 #endif … … 2657 2659 if (t == 0) 2658 2660 { 2659 NEED_IP(1);2661 NEED_IP(1,0); 2660 2662 while (*ip == 0) 2661 2663 { 2662 2664 t += 255; 2663 2665 ip++; 2664 NEED_IP(1 );2666 NEED_IP(1,0); 2665 2667 } 2666 2668 t += 31 + *ip++; … … 2701 2703 if (t == 0) 2702 2704 { 2703 NEED_IP(1);2705 NEED_IP(1,0); 2704 2706 while (*ip == 0) 2705 2707 { 2706 2708 t += 255; 2707 2709 ip++; 2708 NEED_IP(1 );2710 NEED_IP(1,0); 2709 2711 } 2710 2712 t += 7 + *ip++; … … 2749 2751 m_off = 1 + (t >> 2) + (*ip++ << 2); 2750 2752 #endif 2751 NEED_OP(2 );2753 NEED_OP(2,0); 2752 2754 t = 2; COPY_DICT(t,m_off) 2753 2755 #else … … 2761 2763 m_pos -= *ip++ << 2; 2762 2764 #endif 2763 TEST_LOOKBEHIND(m_pos,out); NEED_OP(2 );2765 TEST_LOOKBEHIND(m_pos,out); NEED_OP(2,0); 2764 2766 *op++ = *m_pos++; *op++ = *m_pos; 2765 2767 #endif … … 2769 2771 #if defined(COPY_DICT) 2770 2772 2771 NEED_OP(t +3-1);2773 NEED_OP(t,(3-1)); 2772 2774 t += 3-1; COPY_DICT(t,m_off) 2773 2775 2774 2776 #else 2775 2777 2776 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t +3-1);2778 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t,(3-1)); 2777 2779 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2778 2780 #if !defined(LZO_UNALIGNED_OK_4) … … 2812 2814 2813 2815 match_next: 2814 assert(t > 0); NEED_OP(t ); NEED_IP(t+1);2816 assert(t > 0); NEED_OP(t,0); NEED_IP(t,1); 2815 2817 do *op++ = *ip++; while (--t > 0); 2816 2818 t = *ip++;
Note:
See TracChangeset
for help on using the changeset viewer.