[vala/staging] vala: Prevent possible stack-overflow in Class.is_compact/is_immutable
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Prevent possible stack-overflow in Class.is_compact/is_immutable
- Date: Wed, 19 Feb 2020 14:50:41 +0000 (UTC)
commit 5dad5b3904450417b467a9a05210847c5a9a831b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Feb 19 14:56:37 2020 +0100
vala: Prevent possible stack-overflow in Class.is_compact/is_immutable
Guard recursive call on base_class in is_compact and is_immutable by
checking for cyclic class declaration.
vala/valaclass.vala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index c4f196c64..d5288a757 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -51,7 +51,7 @@ public class Vala.Class : ObjectTypeSymbol {
public bool is_compact {
get {
if (_is_compact == null) {
- if (base_class != null) {
+ if (base_class != null && !base_class.is_subtype_of (this)) {
_is_compact = base_class.is_compact;
} else {
_is_compact = get_attribute ("Compact") != null;
@@ -71,7 +71,7 @@ public class Vala.Class : ObjectTypeSymbol {
public bool is_immutable {
get {
if (_is_immutable == null) {
- if (base_class != null) {
+ if (base_class != null && !base_class.is_subtype_of (this)) {
_is_immutable = base_class.is_immutable;
} else {
_is_immutable = get_attribute ("Immutable") != null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]