summaryrefslogtreecommitdiff
path: root/src/glibext/gbufferview.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-08 11:06:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-08 11:06:17 (GMT)
commit3ad8e821ec6a6e8408a9fc737b385aa863c67123 (patch)
tree078e95ac23aabe0762d9a48746f363bf7bd91600 /src/glibext/gbufferview.c
parentf36b525987442d46c920f76dced29356663ae85b (diff)
Fixed one UAF when dealing with line text segments.
Diffstat (limited to 'src/glibext/gbufferview.c')
-rw-r--r--src/glibext/gbufferview.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/glibext/gbufferview.c b/src/glibext/gbufferview.c
index bc8cf54..f5adc9d 100644
--- a/src/glibext/gbufferview.c
+++ b/src/glibext/gbufferview.c
@@ -725,7 +725,7 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line
line_width_summary summary; /* Résumé concis des largeurs */
gint base; /* Position absolue de segment */
col_coord_t coord; /* Coordonnées en interne */
- const line_segment *segment; /* Bribe de texte trouvée */
+ line_segment *segment; /* Bribe de texte trouvée */
result = false;
@@ -751,6 +751,8 @@ static bool _g_buffer_view_move_caret(GBufferView *view, const GBufferLine *line
result = move_caret_on_line_segment(segment, &offset, ctrl, dir);
+ release_line_segment(segment);
+
}
/* Tentative de déplacement chez le segment voisin ? */
@@ -1031,7 +1033,7 @@ bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const G
size_t index; /* Indice de ligne de tampon */
GBufferLine *line; /* Ligne à la position courante*/
line_width_summary summary; /* Résumé concis des largeurs */
- const line_segment *segment; /* Segment sélectionnable */
+ line_segment *segment; /* Segment sélectionnable */
/* Réinitialisation */
@@ -1075,7 +1077,10 @@ bool g_buffer_view_highlight_segments(GBufferView *view, gint x, gint y, const G
/* Conclusion */
if (segment != NULL)
+ {
result |= add_segment_content_to_selection_list(view->highlighted, segment);
+ release_line_segment(segment);
+ }
if (result)
g_signal_emit_by_name(view, "need-redraw");