summaryrefslogtreecommitdiff
path: root/src/lib/ector/software
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-07-26 13:12:48 +0900
committerHermet Park <hermetpark@gmail.com>2019-07-26 13:12:48 +0900
commit3210fa3d69a639f85c9252d6776fa86060324fbf (patch)
tree07593ddfd7bc08478f2c4ac35274f6c37b7fd44d /src/lib/ector/software
parentf66844ebbf3b58bc5504caacede3fc9ef96418d0 (diff)
ector: Prevent access to NULL buffer in software rasterizer
Summary: Prevents a crash caused by a null pointer exception when ector surface buffer is NULL. Test Plan: N/A Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9390
Diffstat (limited to 'src/lib/ector/software')
-rw-r--r--src/lib/ector/software/ector_software_rasterizer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index a368774310..808f723b81 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -54,6 +54,7 @@ _blend_alpha(int count, const SW_FT_Span *spans, void *user_data)
54 Span_Data *sd = user_data; 54 Span_Data *sd = user_data;
55 const int pix_stride = sd->raster_buffer->stride / 4; 55 const int pix_stride = sd->raster_buffer->stride / 4;
56 Ector_Software_Buffer_Base_Data *mask = sd->mask; 56 Ector_Software_Buffer_Base_Data *mask = sd->mask;
57 if (!mask || !mask->pixels.u32) return;
57 58
58 // multiply the color with mul_col if any 59 // multiply the color with mul_col if any
59 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 60 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -97,6 +98,7 @@ _blend_alpha_inv(int count, const SW_FT_Span *spans, void *user_data)
97 Span_Data *sd = user_data; 98 Span_Data *sd = user_data;
98 const int pix_stride = sd->raster_buffer->stride / 4; 99 const int pix_stride = sd->raster_buffer->stride / 4;
99 Ector_Software_Buffer_Base_Data *mask = sd->mask; 100 Ector_Software_Buffer_Base_Data *mask = sd->mask;
101 if (!mask || !mask->pixels.u32) return;
100 102
101 // multiply the color with mul_col if any 103 // multiply the color with mul_col if any
102 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 104 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
@@ -140,6 +142,7 @@ _blend_mask_add(int count, const SW_FT_Span *spans, void *user_data)
140{ 142{
141 Span_Data *sd = user_data; 143 Span_Data *sd = user_data;
142 Ector_Software_Buffer_Base_Data *mask = sd->mask; 144 Ector_Software_Buffer_Base_Data *mask = sd->mask;
145 if (!mask || !mask->pixels.u32) return;
143 146
144 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 147 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
145 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 148 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
@@ -164,6 +167,7 @@ _blend_mask_sub(int count, const SW_FT_Span *spans, void *user_data)
164{ 167{
165 Span_Data *sd = user_data; 168 Span_Data *sd = user_data;
166 Ector_Software_Buffer_Base_Data *mask = sd->mask; 169 Ector_Software_Buffer_Base_Data *mask = sd->mask;
170 if (!mask || !mask->pixels.u32) return;
167 171
168 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 172 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
169 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 173 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
@@ -189,6 +193,7 @@ _blend_mask_ins(int count, const SW_FT_Span *spans, void *user_data)
189{ 193{
190 Span_Data *sd = user_data; 194 Span_Data *sd = user_data;
191 Ector_Software_Buffer_Base_Data *mask = sd->mask; 195 Ector_Software_Buffer_Base_Data *mask = sd->mask;
196 if (!mask || !mask->pixels.u32) return;
192 197
193 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 198 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
194 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 199 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
@@ -227,6 +232,7 @@ _blend_mask_diff(int count, const SW_FT_Span *spans, void *user_data)
227{ 232{
228 Span_Data *sd = user_data; 233 Span_Data *sd = user_data;
229 Ector_Software_Buffer_Base_Data *mask = sd->mask; 234 Ector_Software_Buffer_Base_Data *mask = sd->mask;
235 if (!mask || !mask->pixels.u32) return;
230 236
231 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col); 237 uint32_t color = DRAW_MUL4_SYM(sd->color, sd->mul_col);
232 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color); 238 RGBA_Comp_Func_Solid comp_func = efl_draw_func_solid_span_get(sd->op, color);
@@ -905,6 +911,7 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
905 int mask_op) 911 int mask_op)
906{ 912{
907 if (!rle) return; 913 if (!rle) return;
914 if (!rasterizer->fill_data.raster_buffer->pixels.u32) return;
908 915
909 rasterizer->fill_data.offx = x; 916 rasterizer->fill_data.offx = x;
910 rasterizer->fill_data.offy = y; 917 rasterizer->fill_data.offy = y;