astroid: apply upstream patch to prevent crashes
This commit is contained in:
parent
471f210452
commit
21a6464165
2 changed files with 55 additions and 1 deletions
|
@ -0,0 +1,53 @@
|
|||
From 03e05bbdae9939cf4716ca2ff47dee75f1f3f57e Mon Sep 17 00:00:00 2001
|
||||
From: Gaute Hope <eg@gaute.vetsj.com>
|
||||
Date: Sat, 20 Oct 2018 19:38:01 +0200
|
||||
Subject: [PATCH] ae: correctly allocate buffer array (-pedantic)
|
||||
|
||||
char[n] is technically not allowed in C++, and seems to cause trouble in
|
||||
this case.
|
||||
---
|
||||
.../thread_view/webextension/ae_protocol.cc | 17 ++++++++++++++---
|
||||
1 file changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modes/thread_view/webextension/ae_protocol.cc b/src/modes/thread_view/webextension/ae_protocol.cc
|
||||
index 735b219b..6687b97b 100644
|
||||
--- a/src/modes/thread_view/webextension/ae_protocol.cc
|
||||
+++ b/src/modes/thread_view/webextension/ae_protocol.cc
|
||||
@@ -59,7 +59,12 @@ namespace Astroid {
|
||||
s &= ostream->write_all ((char*) &mt, sizeof (mt), written);
|
||||
|
||||
/* send message */
|
||||
- s &= ostream->write_all (o, written);
|
||||
+ try {
|
||||
+ s &= ostream->write_all (o, written);
|
||||
+ } catch (Gio::Error &ex) {
|
||||
+ LOG (error) << "ae: error: " << ex.what ();
|
||||
+ throw;
|
||||
+ }
|
||||
ostream->flush ();
|
||||
|
||||
if (!s) {
|
||||
@@ -154,8 +159,13 @@ namespace Astroid {
|
||||
}
|
||||
|
||||
/* read message */
|
||||
- gchar buffer[msg_sz + 1]; buffer[msg_sz] = '\0';
|
||||
- s = istream->read_all (buffer, msg_sz, read, reader_cancel);
|
||||
+ gchar * buffer = new gchar[msg_sz];
|
||||
+ try {
|
||||
+ s = istream->read_all (buffer, msg_sz, read, reader_cancel);
|
||||
+ } catch (Gio::Error &ex) {
|
||||
+ LOG (error) << "ae: error (read): " << ex.code() << ", " << ex.what ();
|
||||
+ throw;
|
||||
+ }
|
||||
|
||||
if (!s || read != msg_sz) {
|
||||
LOG (error) << "reader: error while reading message (size: " << msg_sz << ")";
|
||||
@@ -163,6 +173,7 @@ namespace Astroid {
|
||||
}
|
||||
|
||||
msg_str = std::string (buffer, msg_sz);
|
||||
+ delete [] buffer;
|
||||
return mt;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'astroid'
|
||||
pkgname=astroid
|
||||
version=0.14
|
||||
revision=4
|
||||
revision=5
|
||||
build_style=cmake
|
||||
hostmakedepends="pkg-config scdoc"
|
||||
makedepends="libnotmuch-devel gtkmm-devel webkit2gtk-devel libsass-devel
|
||||
|
@ -13,3 +13,4 @@ license="GPL-3.0-or-later"
|
|||
homepage="http://astroidmail.github.io/"
|
||||
distfiles="https://github.com/astroidmail/astroid/archive/v${version}.tar.gz"
|
||||
checksum=f2642968919527008d383b4c32d4b038c7b6f785ea084dde1222a65162ebc5ca
|
||||
patch_args="-p1"
|
||||
|
|
Loading…
Reference in a new issue