File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
java/ql/src/semmle/code/java Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -305,10 +305,6 @@ class CompileTimeConstantExpr extends Expr {
305305 /**
306306 * Gets the integer value of this expression, where possible.
307307 *
308- * All computations are performed on QL 32-bit `int`s, so no
309- * truncation is performed in the case of overflow within `byte` or `short`:
310- * `((byte)127)+((byte)1)` evaluates to 128 rather than to -128.
311- *
312308 * Note that this does not handle the following cases:
313309 *
314310 * - values of type `long`,
@@ -332,7 +328,10 @@ class CompileTimeConstantExpr extends Expr {
332328 else
333329 if cast .getType ( ) .hasName ( "short" )
334330 then result = ( val + 32768 ) .bitAnd ( 65535 ) - 32768
335- else result = val
331+ else
332+ if cast .getType ( ) .hasName ( "char" )
333+ then result = val .bitAnd ( 65535 )
334+ else result = val
336335 )
337336 or
338337 result = this .( PlusExpr ) .getExpr ( ) .( CompileTimeConstantExpr ) .getIntValue ( )
You can’t perform that action at this time.
0 commit comments