PrestoXen / openopera-issues

Issue tracker for OpenOpera
26 stars 0 forks source link

Delete [] for non-array type #19

Open AlexProfanov opened 7 years ago

AlexProfanov commented 7 years ago

At modules/logdoc/src/htm_elm.cpp:2623 there is lines:

SetAttrSize(new_len);

DELETE_HTML_Attributes(data.attrs);

data.attrs = new_attrs;

This is incorrect, because data.attrs is union - and sometimes it's NOT array, so DELETE_HTML_Attributes (which expands to 'delete []') can NOT be applied to it. I'm very surprised that noone fixed this, because it's practically impossible to use browser with this bug - it crashes on almost all more or less complex pages (e.g. bash.org.ru). After some time debugging I think I found correct fix for this bug. Very funny but working like a charm:

SetAttrSize(new_len);

if (!need_free)
    DELETE_HTML_Attributes(data.attrs);

data.attrs = new_attrs;

It seems that data.attrs is NOT an array then and only then need_free flag is false. Feel free to add this as a patch to openopera repo.

Zero3K commented 4 years ago

Any news regarding this issue?