Permalink
Browse files

Recipe vte, last version that supports gtk2

  • Loading branch information...
bkauler committed Nov 1, 2017
1 parent 421fb1a commit 503952c03e71a806d8fe7d2503657eb8f021c579
@@ -0,0 +1,83 @@
commit 7206376160aac2743a93f70a4726bad4f34fa688
Author: Fuujuhi <fuujuhi-ml1@noekeon.org>
Date: Wed Jul 30 15:52:52 2014 +0200
backporting vte bracked paste mode bug patch on v0.28.2-5ubuntu1
See https://bugzilla.gnome.org/show_bug.cgi?id=729533
Patch at https://bugzilla.gnome.org/attachment.cgi?id=279320
diff --git a/src/vte-private.h b/src/vte-private.h
index 65d5022..ac1f2d8 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -219,7 +219,6 @@ struct _VteTerminalPrivate {
gboolean sendrecv_mode; /* sendrecv mode */
gboolean insert_mode; /* insert mode */
gboolean linefeed_mode; /* linefeed mode */
- gboolean bracketed_paste_mode;
struct vte_scrolling_region {
int start, end;
} scrolling_region; /* the region we scroll in */
@@ -274,6 +273,7 @@ struct _VteTerminalPrivate {
gboolean text_modified_flag;
gboolean text_inserted_flag;
gboolean text_deleted_flag;
+ gboolean bracketed_paste_mode;
/* Scrolling options. */
gboolean scroll_background;
diff --git a/src/vte.c b/src/vte.c
index c20ee78..dbab6de 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5823,10 +5823,10 @@ static void mark_output_source_invalid(VteTerminal *terminal)
p++;
}
}
- if (terminal->pvt->screen->bracketed_paste_mode)
+ if (terminal->pvt->bracketed_paste_mode)
vte_terminal_feed_child(terminal, "\e[200~", -1);
vte_terminal_feed_child(terminal, paste, length);
- if (terminal->pvt->screen->bracketed_paste_mode)
+ if (terminal->pvt->bracketed_paste_mode)
vte_terminal_feed_child(terminal, "\e[201~", -1);
g_free(paste);
}
@@ -14106,14 +14106,12 @@ static void mark_output_source_invalid(VteTerminal *terminal)
pvt->normal_screen.linefeed_mode = FALSE;
pvt->normal_screen.origin_mode = FALSE;
pvt->normal_screen.reverse_mode = FALSE;
- pvt->normal_screen.bracketed_paste_mode = FALSE;
pvt->alternate_screen.scrolling_restricted = FALSE;
pvt->alternate_screen.sendrecv_mode = TRUE;
pvt->alternate_screen.insert_mode = FALSE;
pvt->alternate_screen.linefeed_mode = FALSE;
pvt->alternate_screen.origin_mode = FALSE;
pvt->alternate_screen.reverse_mode = FALSE;
- pvt->alternate_screen.bracketed_paste_mode = FALSE;
pvt->cursor_visible = TRUE;
/* Reset the encoding. */
vte_terminal_set_encoding(terminal, NULL);
@@ -14143,6 +14141,8 @@ static void mark_output_source_invalid(VteTerminal *terminal)
pvt->mouse_last_y = 0;
/* Clear modifiers. */
pvt->modifiers = 0;
+ /* Reset miscellaneous stuff. */
+ pvt->bracketed_paste_mode = FALSE;
/* Cause everything to be redrawn (or cleared). */
vte_terminal_maybe_scroll_to_bottom(terminal);
_vte_invalidate_all(terminal);
diff --git a/src/vteseq.c b/src/vteseq.c
index 209522f..8c8d43c 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -737,7 +737,7 @@
GINT_TO_POINTER(TRUE),
NULL, NULL},
/* 2004: Bracketed paste mode. */
- {2004, &terminal->pvt->screen->bracketed_paste_mode, NULL, NULL,
+ {2004, &terminal->pvt->bracketed_paste_mode, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
@@ -0,0 +1,136 @@
Upstream-Status: Backport
CVE: CVE-2012-2738
Signed-off-by: Ross Burton <ross.burton@intel.com>
From e524b0b3bd8fad844ffa73927c199545b892cdbd Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 19 May 2012 19:36:09 +0200
Subject: [PATCH 1/2] emulation: Limit integer arguments to 65535
To guard against malicious sequences containing excessively big numbers,
limit all parsed numbers to 16 bit range. Doing this here in the parsing
routine is a catch-all guard; this doesn't preclude enforcing
more stringent limits in the handlers themselves.
https://bugzilla.gnome.org/show_bug.cgi?id=676090
---
src/table.c | 2 +-
src/vteseq.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/table.c b/src/table.c
index 140e8c8..85cf631 100644
--- a/src/table.c
+++ b/src/table.c
@@ -550,7 +550,7 @@ _vte_table_extract_numbers(GValueArray **array,
if (G_UNLIKELY (*array == NULL)) {
*array = g_value_array_new(1);
}
- g_value_set_long(&value, total);
+ g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT));
g_value_array_append(*array, &value);
} while (i++ < arginfo->length);
g_value_unset(&value);
diff --git a/src/vteseq.c b/src/vteseq.c
index 7ef4c8c..10991db 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -557,7 +557,7 @@ vte_sequence_handler_multiple(VteTerminal *terminal,
GValueArray *params,
VteTerminalSequenceHandler handler)
{
- vte_sequence_handler_multiple_limited(terminal, params, handler, G_MAXLONG);
+ vte_sequence_handler_multiple_limited(terminal, params, handler, G_MAXUSHORT);
}
static void
--
2.4.9 (Apple Git-60)
From cf1ad453a8def873c49cf6d88162593402f32bb2 Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 19 May 2012 20:04:12 +0200
Subject: [PATCH 2/2] emulation: Limit repetitions
Don't allow malicious sequences to cause excessive repetitions.
https://bugzilla.gnome.org/show_bug.cgi?id=676090
---
src/vteseq.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/vteseq.c b/src/vteseq.c
index 10991db..209522f 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -1392,7 +1392,7 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_DC (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_dc);
+ vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_dc);
}
/* Delete a line at the current cursor position. */
@@ -1785,7 +1785,7 @@ vte_sequence_handler_reverse_index (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_RI (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_nd);
+ vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_nd);
}
/* Save cursor (position). */
@@ -2777,8 +2777,7 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
{
GValue *value;
VteScreen *screen;
- long param, end, row;
- int i;
+ long param, end, row, i, limit;
screen = terminal->pvt->screen;
/* The default is one. */
param = 1;
@@ -2796,7 +2795,13 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
} else {
end = screen->insert_delta + terminal->row_count - 1;
}
- /* Insert the new lines at the cursor. */
+
+ /* Only allow to insert as many lines as there are between this row
+ * and the end of the scrolling region. See bug #676090.
+ */
+ limit = end - row + 1;
+ param = MIN (param, limit);
+
for (i = 0; i < param; i++) {
/* Clear a line off the end of the region and add one to the
* top of the region. */
@@ -2817,8 +2822,7 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
{
GValue *value;
VteScreen *screen;
- long param, end, row;
- int i;
+ long param, end, row, i, limit;
screen = terminal->pvt->screen;
/* The default is one. */
@@ -2837,6 +2841,13 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
} else {
end = screen->insert_delta + terminal->row_count - 1;
}
+
+ /* Only allow to delete as many lines as there are between this row
+ * and the end of the scrolling region. See bug #676090.
+ */
+ limit = end - row + 1;
+ param = MIN (param, limit);
+
/* Clear them from below the current cursor. */
for (i = 0; i < param; i++) {
/* Insert a line at the end of the region and remove one from
--
2.4.9 (Apple Git-60)
@@ -0,0 +1,50 @@
From a9d6a34708f846952f423d078397352858f7b1a4 Mon Sep 17 00:00:00 2001
From: Christian Persch <chpe@gnome.org>
Date: Sat, 12 May 2012 18:48:05 +0200
Subject: [PATCH] keymap: Treat ALT as META
https://bugzilla.gnome.org/show_bug.cgi?id=663779
---
src/vte.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/vte.c b/src/vte.c
index dd27e9a..0657921 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -5170,19 +5170,24 @@ static void
vte_terminal_read_modifiers (VteTerminal *terminal,
GdkEvent *event)
{
+ GdkKeymap *keymap;
GdkModifierType modifiers;
/* Read the modifiers. */
- if (gdk_event_get_state((GdkEvent*)event, &modifiers)) {
- GdkKeymap *keymap;
-#if GTK_CHECK_VERSION (2, 90, 8)
- keymap = gdk_keymap_get_for_display(gdk_window_get_display(((GdkEventAny*)event)->window));
-#else
- keymap = gdk_keymap_get_for_display(gdk_drawable_get_display(((GdkEventAny*)event)->window));
+ if (!gdk_event_get_state((GdkEvent*)event, &modifiers))
+ return;
+
+ keymap = gdk_keymap_get_for_display(gdk_window_get_display(((GdkEventAny*)event)->window));
+
+ gdk_keymap_add_virtual_modifiers (keymap, &modifiers);
+
+#if 1
+ /* HACK! Treat ALT as META; see bug #663779. */
+ if (modifiers & GDK_MOD1_MASK)
+ modifiers |= VTE_META_MASK;
#endif
- gdk_keymap_add_virtual_modifiers (keymap, &modifiers);
- terminal->pvt->modifiers = modifiers;
- }
+
+ terminal->pvt->modifiers = modifiers;
}
/* Read and handle a keypress event. */
--
1.7.5.1.217.g4e3aa.dirty
@@ -0,0 +1,14 @@
Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=691545]
Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
diff -Nurd vte-0.28.2/gnome-pty-helper/configure.in vte-0.28.2/gnome-pty-helper/configure.in
--- vte-0.28.2/gnome-pty-helper/configure.in 2010-07-15 20:08:44.000000000 +0300
+++ vte-0.28.2/gnome-pty-helper/configure.in 2013-01-11 14:50:34.971027440 +0200
@@ -8,7 +8,6 @@
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
-AM_PROG_CC_STDC
if test -z "$enable_maintainer_mode"; then
enable_maintainer_mode=yes
@@ -0,0 +1,67 @@
Index: vte-0.26.0/src/vte.c
===================================================================
--- vte-0.26.0.orig/src/vte.c 2010-11-30 23:04:53.000000000 -0800
+++ vte-0.26.0/src/vte.c 2010-12-07 20:05:07.865548000 -0800
@@ -3862,6 +3862,7 @@ vte_terminal_process_incoming(VteTermina
long wcount, start, delta;
gboolean leftovers, modified, bottom, again;
gboolean invalidated_text;
+ gboolean in_scroll_region;
GArray *unichars;
struct _vte_incoming_chunk *chunk, *next_chunk, *achunk = NULL;
@@ -3881,6 +3882,10 @@ vte_terminal_process_incoming(VteTermina
cursor = screen->cursor_current;
cursor_visible = terminal->pvt->cursor_visible;
+ in_scroll_region = screen->scrolling_restricted
+ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
+ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
+
/* We should only be called when there's data to process. */
g_assert(terminal->pvt->incoming ||
(terminal->pvt->pending->len > 0));
@@ -3979,6 +3984,8 @@ skip_chunk:
* points to the first character which isn't part of this
* sequence. */
if ((match != NULL) && (match[0] != '\0')) {
+ gboolean new_in_scroll_region;
+
/* Call the right sequence handler for the requested
* behavior. */
_vte_terminal_handle_sequence(terminal,
@@ -3989,12 +3996,20 @@ skip_chunk:
start = (next - wbuf);
modified = TRUE;
- /* if we have moved during the sequence handler, restart the bbox */
+ new_in_scroll_region = screen->scrolling_restricted
+ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
+ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
+
+ delta = screen->scroll_delta; /* delta may have changed from sequence. */
+
+ /* if we have moved greatly during the sequence handler, or moved into a scroll_region
+ * from outside it, restart the bbox */
if (invalidated_text &&
- (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) {
+ ((new_in_scroll_region && !in_scroll_region) ||
+ (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) {
/* Clip off any part of the box which isn't already on-screen. */
bbox_topleft.x = MAX(bbox_topleft.x, 0);
bbox_topleft.y = MAX(bbox_topleft.y, delta);
@@ -4014,6 +4029,8 @@ skip_chunk:
bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT;
bbox_topleft.x = bbox_topleft.y = G_MAXINT;
}
+
+ in_scroll_region = new_in_scroll_region;
} else
/* Second, we have a NULL match, and next points to the very
* next character in the buffer. Insert the character which
@@ -0,0 +1,39 @@
# this is the last version supporting gtk2
LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7"
PR = "r1"
SRC_URI = "https://download.gnome.org/sources/vte/0.28/vte-${PV}.tar.bz2 \
file://cve-2012-2738.patch \
file://obsolete_automake_macros.patch \
file://make_alt_work.patch \
file://scroll_region.patch \
file://bracketed_paste_mode_fix.patch"
SRC_URI[md5sum] = "f07a4bf943194f94b7f142db8f7f36dc"
SRC_URI[sha256sum] = "8d04e202b617373dfb47689e5e628febe2c58840b34cccc4af4feb88c48df903"
#DEPENDS = "intltool-native glib-2.0 ncurses libpcre2 libxml2-native gtk+"
DEPENDS = "intltool-native glib-2.0 ncurses libpcre libxml2-native gtk+"
inherit pkgconfig gettext pythonnative autotools distro_features_check gobject-introspection
CFLAGS += "-D_GNU_SOURCE -fno-strict-aliasing"
# do we want this? --enable-introspection
EXTRA_OECONF = "--enable-introspection --disable-python --with-gtk=2.0 --disable-gnome-pty-helper"
# libtool adds "-nostdlib" when g++ is used. This breaks PIE builds.
# Use libtool-cross (which has a hack to prevent that) instead.
EXTRA_OEMAKE_class-target = "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool"
PACKAGES =+ "libvte"
FILES_libvte = "${libdir}/*.so.* ${libdir}/girepository-1.0/*"
#do_configure_append () {
# sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' ${B}/libtool
#}
HOMEPAGE = "https://github.com/GNOME/vte"
SUMMARY = "VTE is a library implementing a terminal emulator widget for GTK+ and a minimal sample application"

0 comments on commit 503952c

Please sign in to comment.