sass / libsass

A C/C++ implementation of a Sass compiler
https://sass-lang.com/libsass
Other
4.34k stars 463 forks source link

Identical subexpressions in op_color_number #3148

Closed ariccio closed 3 years ago

ariccio commented 3 years ago

I ran msvc code analysis while waiting for a heroku instance to deploy, and it found this code introduced in https://github.com/sass/libsass/commit/95011cdac2b485ab7aa4075e9f16d32ad5d08207 in operators.cpp:

      if ((op == Sass_OP::DIV || op == Sass_OP::DIV) && rval == 0) {
        // comparison of Fixnum with Float failed?
        throw Exception::ZeroDivisionError(lhs, rhs);
      }

...that can't be right?

ariccio commented 3 years ago

Sidenote: there are a few other warnings that I cannot decide if they're valid or not:

Warning C26815 The pointer is dangling because it points at a temporary instance which was destroyed.   libsass ...\libsass-master\libsass-master\src\eval.cpp 1090
Warning C26815 The pointer is dangling because it points at a temporary instance which was destroyed.   libsass ...\libsass-master\libsass-master\src\eval.cpp 1050 
mgreter commented 3 years ago

I guess it should have been op == Sass_OP::DIV || op == Sass_OP::MOD.