mktables: Add error check for overloaded &=
authorKarl Williamson <public@khwilliamson.com>
Fri, 8 Jun 2012 03:38:01 +0000 (21:38 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 8 Jun 2012 16:39:22 +0000 (10:39 -0600)
This operation is not commutative, so should fail if the operands are
swapped.

lib/unicore/mktables

index e7aa869..4dc53ed 100644 (file)
@@ -6947,6 +6947,16 @@ sub trace { return main::trace(@_); }
         '&=' => sub {
                         my $self = shift;
                         my $other = shift;
+                        my $reversed = shift;
+
+                        if ($reversed) {
+                            Carp::my_carp_bug("Bad news.  Can't cope with '"
+                            . ref($other)
+                            . ' &= '
+                            . ref($self)
+                            . "'.  undef returned.");
+                            return;
+                        }
 
                         return if $self->carp_if_locked;
                         $self->_set_range_list($self->_range_list & $other);