OLD | NEW |
1 /* | 1 /* |
2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
5 * are granted under this license. | 5 * are granted under this license. |
6 * | 6 * |
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium | 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium |
8 * Copyright (c) 2002-2014, Professor Benoit Macq | 8 * Copyright (c) 2002-2014, Professor Benoit Macq |
9 * Copyright (c) 2001-2003, David Janssens | 9 * Copyright (c) 2001-2003, David Janssens |
10 * Copyright (c) 2002-2003, Yannick Verschueren | 10 * Copyright (c) 2002-2003, Yannick Verschueren |
(...skipping 8193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8204 | 8204 |
8205 /*-----*/ | 8205 /*-----*/ |
8206 /* Compute the area (l_offset_x0_src, l_offset_y0_src, l_offset_
x1_src, l_offset_y1_src) | 8206 /* Compute the area (l_offset_x0_src, l_offset_y0_src, l_offset_
x1_src, l_offset_y1_src) |
8207 * of the input buffer (decoded tile component) which will be mo
ve | 8207 * of the input buffer (decoded tile component) which will be mo
ve |
8208 * in the output buffer. Compute the area of the output buffer (
l_start_x_dest, | 8208 * in the output buffer. Compute the area of the output buffer (
l_start_x_dest, |
8209 * l_start_y_dest, l_width_dest, l_height_dest) which will be m
odified | 8209 * l_start_y_dest, l_width_dest, l_height_dest) which will be m
odified |
8210 * by this input area. | 8210 * by this input area. |
8211 * */ | 8211 * */ |
8212 assert( l_res->x0 >= 0); | 8212 assert( l_res->x0 >= 0); |
8213 assert( l_res->x1 >= 0); | 8213 assert( l_res->x1 >= 0); |
| 8214 |
| 8215 /* Prevent bad casting to unsigned values in the subsequent line
s. */ |
| 8216 if ( l_res->x0 < 0 || l_res->x1 < 0 || l_res->y0 < 0 || l_res->y
1 < 0 ) { |
| 8217 return OPJ_FALSE; |
| 8218 } |
| 8219 |
8214 if ( l_x0_dest < (OPJ_UINT32)l_res->x0 ) { | 8220 if ( l_x0_dest < (OPJ_UINT32)l_res->x0 ) { |
8215 l_start_x_dest = (OPJ_UINT32)l_res->x0 - l_x0_dest; | 8221 l_start_x_dest = (OPJ_UINT32)l_res->x0 - l_x0_dest; |
8216 l_offset_x0_src = 0; | 8222 l_offset_x0_src = 0; |
8217 | 8223 |
8218 if ( l_x1_dest >= (OPJ_UINT32)l_res->x1 ) { | 8224 if ( l_x1_dest >= (OPJ_UINT32)l_res->x1 ) { |
8219 l_width_dest = l_width_src; | 8225 l_width_dest = l_width_src; |
8220 l_offset_x1_src = 0; | 8226 l_offset_x1_src = 0; |
8221 } | 8227 } |
8222 else { | 8228 else { |
8223 l_width_dest = l_x1_dest - (OPJ_UINT32)l_res->x0
; | 8229 l_width_dest = l_x1_dest - (OPJ_UINT32)l_res->x0
; |
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10804 return OPJ_FALSE; | 10810 return OPJ_FALSE; |
10805 } | 10811 } |
10806 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) { | 10812 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) { |
10807 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k
_post_write_tile with tile index = %d\n", p_tile_index); | 10813 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k
_post_write_tile with tile index = %d\n", p_tile_index); |
10808 return OPJ_FALSE; | 10814 return OPJ_FALSE; |
10809 } | 10815 } |
10810 } | 10816 } |
10811 | 10817 |
10812 return OPJ_TRUE; | 10818 return OPJ_TRUE; |
10813 } | 10819 } |
OLD | NEW |