HaxeFoundation / HaxeFoundation/hxcpp

Invalid cast succeeds and leads to crash

Open
#751 25 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

Here is a simple class to reproduce the issue:

```
class HxcppBug
{
public static function main()
{
var s : String = "";

var c = try cast(s, Interface) catch (e : Dynamic) null;

if ((c == null) || c.foo) {
trace("Impossible");
}
}
}

private interface Interface
{
var foo(get, null) : Bool;
}
```

This program crashes. c should be evaluated to null, but is instead just assigned from s. Then the call to the get_foo() function crashes since there is no such function on String.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.