HaxeFoundation / HaxeFoundation/hxcpp

Invalid cast succeeds and leads to crash

Aperta
#751 25 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
330
Fork
227
Merge medio
2g 16h
PR unite (30g)
18

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start with the supplied Haxe reproducer and run it through the C++ backend to confirm that the invalid cast returns the String instead of null and crashes during foo access. Trace the runtime cast and interface-dispatch paths in the repository's C++ runtime files; done means the reproducer evaluates the cast to null and no longer crashes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.