summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-01-13 11:24:07 +0000
committertavmjong-free <tavmjong@free.fr>2014-01-13 11:24:07 +0000
commit2919a4d76fb8e60bbfefecedbeac05749b5ca805 (patch)
tree49eee89df1a13c78b3290b9a9e973fbe9f91a1dd /src
parentupdate 2geom's copy to r2142 (diff)
downloadinkscape-2919a4d76fb8e60bbfefecedbeac05749b5ca805.tar.gz
inkscape-2919a4d76fb8e60bbfefecedbeac05749b5ca805.zip
Prevent segfault if 'tableValues' is empty.
(bzr r12922)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-filter-component-transfer.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp
index 3bc00d2d7..dd90193fe 100644
--- a/src/display/nr-filter-component-transfer.cpp
+++ b/src/display/nr-filter-component-transfer.cpp
@@ -254,16 +254,21 @@ void FilterComponentTransfer::render_cairo(FilterSlot &slot)
// parameters: R = 0, G = 1, B = 2, A = 3
// Cairo: R = 2, G = 1, B = 0, A = 3
+ // If tableValues is empty, use identity.
for (unsigned i = 0; i < 3; ++i) {
guint32 color = 2 - i;
switch (type[i]) {
case COMPONENTTRANSFER_TYPE_TABLE:
- ink_cairo_surface_filter(out, out,
- ComponentTransferTable<false>(color, tableValues[i]));
+ if(!tableValues[i].empty()) {
+ ink_cairo_surface_filter(out, out,
+ ComponentTransferTable<false>(color, tableValues[i]));
+ }
break;
case COMPONENTTRANSFER_TYPE_DISCRETE:
- ink_cairo_surface_filter(out, out,
- ComponentTransferDiscrete<false>(color, tableValues[i]));
+ if(!tableValues[i].empty()) {
+ ink_cairo_surface_filter(out, out,
+ ComponentTransferDiscrete<false>(color, tableValues[i]));
+ }
break;
case COMPONENTTRANSFER_TYPE_LINEAR:
ink_cairo_surface_filter(out, out,
@@ -284,12 +289,16 @@ void FilterComponentTransfer::render_cairo(FilterSlot &slot)
// fast paths for alpha channel
switch (type[3]) {
case COMPONENTTRANSFER_TYPE_TABLE:
- ink_cairo_surface_filter(out, out,
- ComponentTransferTable<true>(tableValues[3]));
+ if(!tableValues[3].empty()) {
+ ink_cairo_surface_filter(out, out,
+ ComponentTransferTable<true>(tableValues[3]));
+ }
break;
case COMPONENTTRANSFER_TYPE_DISCRETE:
- ink_cairo_surface_filter(out, out,
- ComponentTransferDiscrete<true>(tableValues[3]));
+ if(!tableValues[3].empty()) {
+ ink_cairo_surface_filter(out, out,
+ ComponentTransferDiscrete<true>(tableValues[3]));
+ }
break;
case COMPONENTTRANSFER_TYPE_LINEAR:
ink_cairo_surface_filter(out, out,