Skip to content
Snippets Groups Projects
Commit 3cfac69e authored by Sören Tempel's avatar Sören Tempel
Browse files

community/radare2: fix double-free causing crash on exit

Backported from upstream.
parent 52db8d39
No related branches found
No related tags found
No related merge requests found
From 64676437e9aa46f3cf614e06e4f03e31fc461c94 Mon Sep 17 00:00:00 2001
From: pancake <pancake@nopcode.org>
Date: Wed, 23 Dec 2020 21:29:05 +0100
Subject: [PATCH] Fix double-free in charset sdb
---
libr/core/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libr/core/core.c b/libr/core/core.c
index 81c991ffc..f72e581d7 100644
--- a/libr/core/core.c
+++ b/libr/core/core.c
@@ -2714,6 +2714,9 @@ R_API bool r_core_init(RCore *core) {
core->lastcmd = NULL;
core->cmdlog = NULL;
core->print->charset->db = sdb_ns (core->sdb, "charset", 1);
+ core->print->charset->db->refs++; // increase reference counter to avoid double-free
+ // ideally sdb_ns_set should be used here, but it doesnt seems to work well. must fix
+ // sdb_ns_set (DB, "charset", core->print->charset->db);
core->stkcmd = NULL;
core->cmdqueue = NULL;
core->cmdrepeat = true;
......@@ -5,7 +5,7 @@
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=radare2
pkgver=5.0.0
pkgrel=0
pkgrel=1
pkgdesc="An opensource, crossplatform reverse engineering framework"
url="http://www.radare.org"
arch="all"
......@@ -14,6 +14,7 @@ options="!check" # upstream does not provide any working testsuite
makedepends="$depends_dev libzip-dev openssl-dev capstone-dev linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/radare/radare2/archive/$pkgver.tar.gz
0001-Fix-double-free-in-charset-sdb.patch
string-header-build-fix.patch"
# secfixes:
......@@ -47,4 +48,5 @@ package() {
}
sha512sums="059bc341bc34c5f39ef7493af9e2d3b7e52667a2d16f12ef19c9c6ba83c911fd02e07cd527599caea503d5e81a5fedbd8ff343db4d41257e0f48ace9dd52f3ba radare2-5.0.0.tar.gz
5b0afdfb71b1c75dbdaf0b69320564469883fb3c74218a592bf08c147f9b786ac7d1bbee19f54fb9b739778ce9930c0bae2e6ea8d03a1fa22d2f3827f95d3e88 0001-Fix-double-free-in-charset-sdb.patch
5e60a1112a10cdd6a31374ba9b564d6522a37086380cf74b7232e32fb700ae1b2f68edbc0726ebedcc31d4789bc4f89525f117f25dac3609c60a75d471e49c85 string-header-build-fix.patch"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment