lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
November 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
57 discussions
Start a n
N
ew thread
[geany/geany-plugins] f0b2d4: debugger: Fix a few integer signedness comparison issues
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Mon, 27 Oct 2014 20:49:45 UTC Commit: f0b2d4b913bf30d7f1f108d0fa808283fdaaad3c
https://github.com/geany/geany-plugins/commit/f0b2d4b913bf30d7f1f108d0fa808…
Log Message: ----------- debugger: Fix a few integer signedness comparison issues Modified Paths: -------------- debugger/src/dpaned.c debugger/src/markers.c debugger/src/plugin.c Modified: debugger/src/dpaned.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -154,10 +154,10 @@ static void on_page_reordered(GtkNotebook *notebook, GtkWidget *child, guint pag gboolean is_tabbed = config_get_tabbed(); int *tabs = NULL; gsize length; - int prev_index; + gsize prev_index, min, max; GtkWidget *page; tab_id id; - int i, min, max; + int i; int config_part_tabs; int config_part_selected_index; int *array; Modified: debugger/src/markers.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -98,7 +98,7 @@ void markers_set_for_document(ScintillaObject *sci) void markers_init(void) { /* set markers in all currently opened documents */ - int i; + guint i; foreach_document(i) markers_set_for_document(document_index(i)->editor->sci); } Modified: debugger/src/plugin.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -89,7 +89,7 @@ static void on_paned_mode_changed(GtkToggleButton *button, gpointer user_data) void plugin_init(GeanyData *data) { GtkWidget* vbox; - int i; + guint i; plugin_module_make_resident(geany_plugin); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] ca6331: debugger: Fix a few things in the GDB/MI parser
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 21:49:44 UTC Commit: ca63317464ddbdae68073e4a471a41363a0028bb
https://github.com/geany/geany-plugins/commit/ca63317464ddbdae68073e4a471a4…
Log Message: ----------- debugger: Fix a few things in the GDB/MI parser Including: * Fix parsing hex escapes; * Allow short forms for hex and octal escapes; * Remove some dead code; * Disable debugging prints; * Only recognize ASCII for special meanings. Modified Paths: -------------- debugger/src/gdb_mi.c Modified: debugger/src/gdb_mi.c 204 lines changed, 89 insertions(+), 115 deletions(-) =================================================================== @@ -21,27 +21,22 @@ /* * Parses GDB/MI records - *
http://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_214.html
+ *
https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI-Output-Syntax.…
*/ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <ctype.h> #include <glib.h> #include "gdb_mi.h" -#define DEBUG -#define isodigit(c) ((c) >= '0' && (c) <= '7') +#define ascii_isodigit(c) (((guchar) (c)) >= '0' && ((guchar) (c)) <= '7') -#if defined(DEBUG) || defined(TEST) -static void gdb_mi_result_dump(const struct gdb_mi_result *r, gboolean next, gint indent); -#endif static struct gdb_mi_value *parse_value(const gchar **p); @@ -85,46 +80,6 @@ void gdb_mi_record_free(struct gdb_mi_record *record) g_free(record); } -#if defined(DEBUG) || defined(TEST) - -static void gdb_mi_value_dump(const struct gdb_mi_value *v, gint indent) -{ - fprintf(stderr, "%*stype = %d\n", indent * 2, "", v->type); - switch (v->type) - { - case GDB_MI_VAL_STRING: - fprintf(stderr, "%*sstring = %s\n", indent * 2, "", v->string); - break; - case GDB_MI_VAL_LIST: - fprintf(stderr, "%*slist =>\n", indent * 2, ""); - if (v->list) - gdb_mi_result_dump(v->list, TRUE, indent + 1); - break; - } -} - -static void gdb_mi_result_dump(const struct gdb_mi_result *r, gboolean next, gint indent) -{ - fprintf(stderr, "%*svar = %s\n", indent * 2, "", r->var); - fprintf(stderr, "%*sval =>\n", indent * 2, ""); - gdb_mi_value_dump(r->val, indent + 1); - if (next && r->next) - gdb_mi_result_dump(r->next, next, indent); -} - -static void gdb_mi_record_dump(const struct gdb_mi_record *record) -{ - fprintf(stderr, "record =>\n"); - fprintf(stderr, " type = '%c' (%d)\n", record->type ? record->type : '0', record->type); - fprintf(stderr, " token = %s\n", record->token); - fprintf(stderr, " class = %s\n", record->klass); - fprintf(stderr, " results =>\n"); - if (record->first) - gdb_mi_result_dump(record->first, TRUE, 2); -} - -#endif - /* parses: cstring * * cstring is defined as: @@ -134,7 +89,9 @@ static void gdb_mi_record_dump(const struct gdb_mi_record *record) * * FIXME: what exactly does "seven-bit-iso-c-string-content" mean? * reading between the lines suggests it's US-ASCII with values >= 0x80 - * encoded as \NNN (most likely octal), but that's not really clear */ + * encoded as \NNN (most likely octal), but that's not really clear -- + * although it parses everything I encountered + * FIXME: this does NOT convert to UTF-8. should it? */ static gchar *parse_cstring(const gchar **p) { GString *str = g_string_new(NULL); @@ -144,35 +101,55 @@ static gchar *parse_cstring(const gchar **p) (*p)++; while (**p != '"') { - int c = **p; + gchar c = **p; /* TODO: check expansions here */ if (c == '\\') { (*p)++; c = **p; - switch (tolower(c)) + switch (g_ascii_tolower(c)) { case '\\': case '"': break; case 'a': c = '\a'; break; case 'b': c = '\b'; break; + case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\v'; break; default: - /* two-digit hex escape */ - if (tolower(c) == 'x' && isxdigit((*p)[1]) && isxdigit((*p)[2])) + /* hex escape, 1-2 digits (\xN or \xNN) + * + * FIXME: is this useful? Is this right? + * the original dbm_gdb.c:unescape_hex_values() used to + * read escapes of the form \xNNN and treat them as wide + * characters numbers, but this looks weird for a C-like + * escape. + * Also, note that this doesn't seem to be referenced anywhere + * in GDB/MI syntax. Only reference in GDB manual is about + * keybindings, which use the syntax implemented here */ + if (g_ascii_tolower(**p) == 'x' && g_ascii_isxdigit((*p)[1])) { - c = (tolower(*++(*p)) - '0') * 16; - c += (tolower(*++(*p)) - '0'); + c = (gchar) g_ascii_xdigit_value(*++(*p)); + if (g_ascii_isxdigit((*p)[1])) + c = (gchar) ((c * 16) + g_ascii_xdigit_value(*++(*p))); } - /* three-digit octal escape */ - else if (c >= '0' && c <= '3' && isodigit((*p)[1]) && isodigit((*p)[2])) + /* octal escape, 1-3 digits (\N, \NN or \NNN) */ + else if (ascii_isodigit(**p)) { - c = (* (*p) - '0') * 8 * 8; - c += (*++(*p) - '0') * 8; - c += (*++(*p) - '0'); + int i, v; + v = g_ascii_digit_value(**p); + for (i = 0; ascii_isodigit((*p)[1]) && i < 2; i++) + v = (v * 8) + g_ascii_digit_value(*++(*p)); + if (v <= 0xff) + c = (gchar) v; + else + { + *p = *p - 3; /* put the whole sequence back */ + c = **p; + g_warning("Octal escape sequence out of range: %.4s", *p); + } } else { @@ -185,7 +162,7 @@ static gchar *parse_cstring(const gchar **p) } if (**p == '\0') break; - g_string_append_c(str, (gchar) c); + g_string_append_c(str, c); (*p)++; } if (**p == '"') @@ -195,16 +172,16 @@ static gchar *parse_cstring(const gchar **p) } /* parses: string - * FIXME: what really is a string? here it uses [a-zA-Z_][a-zA-Z0-9_-.]* but + * FIXME: what really is a string? here it uses [a-zA-Z_-.][a-zA-Z0-9_-.]* but * the docs aren't clear on this */ static gchar *parse_string(const gchar **p) { GString *str = g_string_new(NULL); - if (isalpha(**p) || **p == '_') + if (g_ascii_isalpha(**p) || strchr("-_.", **p)) { g_string_append_c(str, **p); - for ((*p)++; isalnum(**p) || strchr("-_.", **p); (*p)++) + for ((*p)++; g_ascii_isalnum(**p) || strchr("-_.", **p); (*p)++) g_string_append_c(str, **p); } return g_string_free(str, FALSE); @@ -214,11 +191,11 @@ static gchar *parse_string(const gchar **p) static gboolean parse_result(struct gdb_mi_result *result, const gchar **p) { result->var = parse_string(p); - while (isspace(**p)) (*p)++; + while (g_ascii_isspace(**p)) (*p)++; if (**p == '=') { (*p)++; - while (isspace(**p)) (*p)++; + while (g_ascii_isspace(**p)) (*p)++; result->val = parse_value(p); } return result->var && result->val; @@ -243,7 +220,7 @@ static struct gdb_mi_value *parse_value(const gchar **p) while (**p && **p != end) { struct gdb_mi_result *item = g_malloc0(sizeof *item); - while (isspace(**p)) (*p)++; + while (g_ascii_isspace(**p)) (*p)++; if ((item->val = parse_value(p)) || parse_result(item, p)) { @@ -258,7 +235,7 @@ static struct gdb_mi_value *parse_value(const gchar **p) gdb_mi_result_free(item, TRUE); break; } - while (isspace(**p)) (*p)++; + while (g_ascii_isspace(**p)) (*p)++; if (**p != ',') break; (*p)++; } @@ -303,30 +280,26 @@ struct gdb_mi_record *gdb_mi_record_parse(const gchar *line) struct gdb_mi_record *record = g_malloc0(sizeof *record); char nl; -#ifdef DEBUG - fprintf(stderr, "line: %s\n", line); -#endif - + /* FIXME */ if (sscanf(line, "(gdb) %c", &nl) == 1 && (nl == '\r' || nl == '\n')) record->type = GDB_MI_TYPE_PROMPT; else { /* extract token */ const gchar *token_end = line; - for (token_end = line; isdigit(*token_end); token_end++) + for (token_end = line; g_ascii_isdigit(*token_end); token_end++) ; if (token_end > line) { record->token = g_strndup(line, (gsize)(token_end - line)); line = token_end; - while (isspace(*line)) - line++; + while (g_ascii_isspace(*line)) line++; } /* extract record */ record->type = *line; ++line; - while (isspace(*line)) line++; + while (g_ascii_isspace(*line)) line++; switch (record->type) { case '~': @@ -340,7 +313,7 @@ struct gdb_mi_record *gdb_mi_record_parse(const gchar *line) * > line) or a quoted C string (which does not contain an * > implicit newline). * - * This adds "raw text" to "c-string", so? */ + * This adds "raw text" to "c-string"... so? */ record->klass = parse_cstring(&line); break; case '^': @@ -352,14 +325,14 @@ struct gdb_mi_record *gdb_mi_record_parse(const gchar *line) record->klass = parse_string(&line); while (*line) { - while (isspace(*line)) line++; + while (g_ascii_isspace(*line)) line++; if (*line != ',') break; else { struct gdb_mi_result *res = g_malloc0(sizeof *res); line++; - while (isspace(*line)) line++; + while (g_ascii_isspace(*line)) line++; if (!parse_result(res, &line)) { g_warning("failed to parse result"); @@ -381,12 +354,6 @@ struct gdb_mi_record *gdb_mi_record_parse(const gchar *line) } } -#ifdef DEBUG - if (! (gdb_mi_record_matches(record, '^', "done", NULL) && - gdb_mi_result_var(record->first, "files", GDB_MI_VAL_LIST))) - gdb_mi_record_dump(record); -#endif - return record; } @@ -422,37 +389,6 @@ const void *gdb_mi_result_var(const struct gdb_mi_result *result, const gchar *n return NULL; } -/* FIXME: */ -const void *gdb_mi_result_var_path(const struct gdb_mi_result *result, const gchar *path, enum gdb_mi_value_type type) -{ - gchar **chunks = g_strsplit(path, "/", -1); - gchar **p; - void *value = NULL; - - for (p = chunks; *p; p++) - { - const struct gdb_mi_value *val = gdb_mi_result_var_value(result, *p); - if (! val) - break; - if (! p[1]) - { - if (val->type == type) - { - if (val->type == GDB_MI_VAL_STRING) - value = val->string; - else if (val->type == GDB_MI_VAL_LIST) - value = val->list; - } - } - else if (val->type == GDB_MI_VAL_LIST) - result = val->list; - else - break; - } - g_strfreev(chunks); - return value; -} - /* checks whether a record matches, possibly including some string values * @param record a record * @param type the expected type of the record @@ -495,6 +431,44 @@ gboolean gdb_mi_record_matches(const struct gdb_mi_record *record, enum gdb_mi_r #ifdef TEST +static void gdb_mi_result_dump(const struct gdb_mi_result *r, gboolean next, gint indent); + +static void gdb_mi_value_dump(const struct gdb_mi_value *v, gint indent) +{ + fprintf(stderr, "%*stype = %d\n", indent * 2, "", v->type); + switch (v->type) + { + case GDB_MI_VAL_STRING: + fprintf(stderr, "%*sstring = %s\n", indent * 2, "", v->string); + break; + case GDB_MI_VAL_LIST: + fprintf(stderr, "%*slist =>\n", indent * 2, ""); + if (v->list) + gdb_mi_result_dump(v->list, TRUE, indent + 1); + break; + } +} + +static void gdb_mi_result_dump(const struct gdb_mi_result *r, gboolean next, gint indent) +{ + fprintf(stderr, "%*svar = %s\n", indent * 2, "", r->var); + fprintf(stderr, "%*sval =>\n", indent * 2, ""); + gdb_mi_value_dump(r->val, indent + 1); + if (next && r->next) + gdb_mi_result_dump(r->next, next, indent); +} + +static void gdb_mi_record_dump(const struct gdb_mi_record *record) +{ + fprintf(stderr, "record =>\n"); + fprintf(stderr, " type = '%c' (%d)\n", record->type ? record->type : '0', record->type); + fprintf(stderr, " token = %s\n", record->token); + fprintf(stderr, " class = %s\n", record->klass); + fprintf(stderr, " results =>\n"); + if (record->first) + gdb_mi_result_dump(record->first, TRUE, 2); +} + int main(void) { char buf[256] = {0}; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 3afcc8: debugger: Make GCC happy
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 21:57:39 UTC Commit: 3afcc8f56516532810fd3b76ad39697143e58246
https://github.com/geany/geany-plugins/commit/3afcc8f56516532810fd3b76ad396…
Log Message: ----------- debugger: Make GCC happy Apparently GCC is not smart enough to understand that when the a NULL name is passed to `gdb_mi_result_foreach_matched` the `strcmp()` call cannot possibly happen. Work around the warnings it emits by adding an explicit (and useless) check on the `strcmp()` argument, which probably will be optimized out anyway. Modified Paths: -------------- debugger/src/gdb_mi.h Modified: debugger/src/gdb_mi.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -78,7 +78,7 @@ gboolean gdb_mi_record_matches(const struct gdb_mi_record *record, enum gdb_mi_r #define gdb_mi_result_foreach_matched(node_, result_, name_, type_) \ gdb_mi_result_foreach ((node_), (result_)) \ - if (((name_) != NULL && (! (node_)->var || strcmp((node_)->var, (name_)) != 0)) || \ + if (((name_) != NULL && (! (node_)->var || strcmp((node_)->var, (name_) ? (name_) : "") != 0)) || \ ((type_) >= 0 && (node_)->val->type != (type_))) \ continue; \ else -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] b7b467: debugger: Consolidate code for selecting the target file
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 15:46:50 UTC Commit: b7b4677d6ba5b3d27aeecae613bccd465b2b1335
https://github.com/geany/geany-plugins/commit/b7b4677d6ba5b3d27aeecae613bcc…
Log Message: ----------- debugger: Consolidate code for selecting the target file This fixes a leak, a possible NULL-pointer dereference and buffer overflows. Modified Paths: -------------- debugger/src/tpage.c Modified: debugger/src/tpage.c 17 lines changed, 9 insertions(+), 8 deletions(-) =================================================================== @@ -97,10 +97,10 @@ static void on_arguments_changed(GtkTextBuffer *textbuffer, gpointer user_data) */ static void on_target_browse_clicked(GtkButton *button, gpointer user_data) { - gchar path[FILENAME_MAX]; + gchar *path; const gchar *prevfile; - gchar *prevdir; GtkWidget *dialog; + GeanyDocument *doc; dialog = gtk_file_chooser_dialog_new (_("Choose target file"), NULL, @@ -110,14 +110,15 @@ static void on_target_browse_clicked(GtkButton *button, gpointer user_data) NULL); prevfile = gtk_entry_get_text(GTK_ENTRY(target_name)); - prevdir = g_path_get_dirname(prevfile); - if (strcmp(".", prevdir)) - strcpy(path, prevdir); - else - strcpy(path, g_path_get_dirname(DOC_FILENAME(document_get_current()))); - g_free(prevdir); + path = g_path_get_dirname(prevfile); + if (strcmp(".", path) == 0 && (doc = document_get_current()) != NULL) + { + g_free(path); + path = g_path_get_dirname(DOC_FILENAME(doc)); + } gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), path); + g_free(path); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] dc7804: debugger: Avoid possible overflows with strcpy()
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 14:32:58 UTC Commit: dc7804b0cc04d6155a80864ff94042fe66add293
https://github.com/geany/geany-plugins/commit/dc7804b0cc04d6155a80864ff9404…
Log Message: ----------- debugger: Avoid possible overflows with strcpy() Modified Paths: -------------- debugger/src/breakpoint.c debugger/src/breakpoints.c debugger/src/dbm_gdb.c Modified: debugger/src/breakpoint.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -50,10 +50,10 @@ breakpoint* break_new(void) breakpoint* break_new_full(const char* file, int line, const char* condition, int enabled, int hitscount) { breakpoint* bp = break_new(); - strcpy(bp->file, file); + strncpy(bp->file, file, G_N_ELEMENTS(bp->file) - 1); bp->line = line; if (condition) - strcpy(bp->condition, condition); + strncpy(bp->condition, condition, G_N_ELEMENTS(bp->condition) - 1); bp->enabled = enabled; bp->hitscount = hitscount; Modified: debugger/src/breakpoints.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -227,7 +227,7 @@ static void breaks_set_condition_debug(breakpoint* bp) { /* revert to old condition (taken from tree) */ gchar* oldcondition = bptree_get_condition(bp); - strcpy(bp->condition, oldcondition); + strncpy(bp->condition, oldcondition, G_N_ELEMENTS(bp->condition) - 1); g_free(oldcondition); /* show error message */ dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", debug_error_message()); @@ -596,7 +596,7 @@ void breaks_set_condition(const char* file, int line, const char* condition) return; /* change condition */ - strcpy(bp->condition, condition); + strncpy(bp->condition, condition, G_N_ELEMENTS(bp->condition) - 1); /* handle setting condition instantly if debugger is idle or stopped and request debug module interruption overwise */ Modified: debugger/src/dbm_gdb.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -711,7 +711,7 @@ static result_class exec_sync_command(const gchar* command, gboolean wait4prompt { /* save error message */ gchar* msg = g_strcompress(strstr(coma, "msg=\"") + strlen("msg=\"")); - strcpy(err_message, msg); + strncpy(err_message, msg, G_N_ELEMENTS(err_message) - 1); g_free(msg); rc = RC_ERROR; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 0a61a7: debugger: Don't try destroying a NULL GHashTable
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 15:45:01 UTC Commit: 0a61a7698f7519530cff60ccbdf6f16823377478
https://github.com/geany/geany-plugins/commit/0a61a7698f7519530cff60ccbdf6f…
Log Message: ----------- debugger: Don't try destroying a NULL GHashTable Modified Paths: -------------- debugger/src/debug.c Modified: debugger/src/debug.c 7 lines changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -832,8 +832,11 @@ static void on_debugger_exited (int code) read_only_pages = NULL; /* clear and destroy calltips cache */ - g_hash_table_destroy(calltips); - calltips = NULL; + if (calltips) + { + g_hash_table_destroy(calltips); + calltips = NULL; + } /* enable widgets */ enable_sensitive_widgets(TRUE); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] ecb4ba: debugger: Don't work on NULL GString or GHashTable
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 13:05:38 UTC Commit: ecb4ba7aadf0cc1920d2ac7323e435fb22201e1e
https://github.com/geany/geany-plugins/commit/ecb4ba7aadf0cc1920d2ac7323e43…
Log Message: ----------- debugger: Don't work on NULL GString or GHashTable Modified Paths: -------------- debugger/src/dbm_gdb.c debugger/src/debug.c Modified: debugger/src/dbm_gdb.c 6 lines changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -259,9 +259,11 @@ static void gdb_input_write_line(const gchar *line) */ static void free_queue_item(queue_item *item) { - g_string_free(item->message, TRUE); + if (item->message) + g_string_free(item->message, TRUE); g_string_free(item->command, TRUE); - g_string_free(item->error_message, TRUE); + if (item->error_message) + g_string_free(item->error_message, TRUE); g_free(item); } Modified: debugger/src/debug.c 46 lines changed, 25 insertions(+), 21 deletions(-) =================================================================== @@ -662,7 +662,8 @@ static void on_debugger_stopped (int thread_id) } /* clear calltips cache */ - g_hash_table_remove_all(calltips); + if (calltips) + g_hash_table_remove_all(calltips); /* if a stop was requested for asyncronous exiting - * stop debug module and exit */ @@ -927,7 +928,8 @@ static void on_select_frame(int frame_number) active_module->set_active_frame(frame_number); /* clear calltips cache */ - g_hash_table_remove_all(calltips); + if (calltips) + g_hash_table_remove_all(calltips); /* autos */ autos = active_module->get_autos(); @@ -1326,33 +1328,35 @@ gchar* debug_get_calltip_for_expression(gchar* expression) if (var) { calltip_str = get_calltip_line(var, TRUE); - if (var->has_children) + if (calltip_str) { - int lines_left = MAX_CALLTIP_HEIGHT - 1; - GList* children = active_module->get_children(var->internal->str); - GList* child = children; - while(child && lines_left) + if (var->has_children) { - variable *varchild = (variable*)child->data; - GString *child_string = get_calltip_line(varchild, FALSE); - g_string_append_printf(calltip_str, "\n%s", child_string->str); - g_string_free(child_string, TRUE); + int lines_left = MAX_CALLTIP_HEIGHT - 1; + GList* children = active_module->get_children(var->internal->str); + GList* child = children; + while(child && lines_left) + { + variable *varchild = (variable*)child->data; + GString *child_string = get_calltip_line(varchild, FALSE); + g_string_append_printf(calltip_str, "\n%s", child_string->str); + g_string_free(child_string, TRUE); - child = child->next; - lines_left--; - } - if (!lines_left && child) - { - g_string_append(calltip_str, "\n\t\t........"); + child = child->next; + lines_left--; + } + if (!lines_left && child) + { + g_string_append(calltip_str, "\n\t\t........"); + } + g_list_foreach(children, (GFunc)variable_free, NULL); + g_list_free(children); } - g_list_foreach(children, (GFunc)variable_free, NULL); - g_list_free(children); + calltip = g_string_free(calltip_str, FALSE); } active_module->remove_watch(var->internal->str); - calltip = g_string_free(calltip_str, FALSE); - if (!calltips) { calltips = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] c40d33: debugger: Don't remove non-existent GSources
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 13:16:46 UTC Commit: c40d3342dbdf30cf578bcf6ff39566681c850a3f
https://github.com/geany/geany-plugins/commit/c40d3342dbdf30cf578bcf6ff3956…
Log Message: ----------- debugger: Don't remove non-existent GSources Modified Paths: -------------- debugger/src/dbm_gdb.c Modified: debugger/src/dbm_gdb.c 25 lines changed, 21 insertions(+), 4 deletions(-) =================================================================== @@ -192,6 +192,7 @@ static void on_gdb_exit(GPid pid, gint status, gpointer data) files = NULL; g_source_remove(gdb_src_id); + gdb_src_id = 0; dbg_cbs->set_exited(0); } @@ -325,7 +326,11 @@ static gboolean on_read_async_output(GIOChannel * src, GIOCondition cond, gpoint GList *commands = (GList*)data; gchar *coma; - g_source_remove(gdb_id_out); + if (gdb_id_out) + { + g_source_remove(gdb_id_out); + gdb_id_out = 0; + } lines = read_until_prompt(); g_list_foreach(lines, (GFunc)g_free, NULL); @@ -367,7 +372,11 @@ static gboolean on_read_async_output(GIOChannel * src, GIOCondition cond, gpoint free_commands_queue(commands); /* removing read callback */ - g_source_remove(gdb_id_out); + if (gdb_id_out) + { + g_source_remove(gdb_id_out); + gdb_id_out = 0; + } /* update source files list */ update_files(); @@ -491,7 +500,11 @@ static gboolean on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer d char *reason; /* removing read callback (will pulling all output left manually) */ - g_source_remove(gdb_id_out); + if (gdb_id_out) + { + g_source_remove(gdb_id_out); + gdb_id_out = 0; + } /* looking for a reason to stop */ reason = strstr(record, "reason=\""); @@ -580,7 +593,11 @@ static gboolean on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer d char *msg; /* removing read callback (will pulling all output left manually) */ - g_source_remove(gdb_id_out); + if (gdb_id_out) + { + g_source_remove(gdb_id_out); + gdb_id_out = 0; + } /* set debugger stopped if is running */ if (DBS_STOPPED != debug_get_state()) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 2b38b7: debugger: Avoid a theoretically possible buffer overflow
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 12:42:35 UTC Commit: 2b38b72ab87534f652919fd3013576bb38c3ddbc
https://github.com/geany/geany-plugins/commit/2b38b72ab87534f652919fd301357…
Log Message: ----------- debugger: Avoid a theoretically possible buffer overflow Modified Paths: -------------- debugger/src/dbm_gdb.c Modified: debugger/src/dbm_gdb.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -227,7 +227,7 @@ static void gdb_input_write_line(const gchar *line) gsize count; char command[1000]; - sprintf(command, "%s\n", line); + snprintf(command, sizeof command, "%s\n", line); while (strlen(command)) { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 785b83: debugger: Avoid undefined behavior with strcpy()
by Colomban Wendling
15 Nov '15
15 Nov '15
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 25 Oct 2014 12:43:49 UTC Commit: 785b83534469eddd212029862f8ccb69a9c4f724
https://github.com/geany/geany-plugins/commit/785b83534469eddd212029862f8cc…
Log Message: ----------- debugger: Avoid undefined behavior with strcpy() strcpy() requires that the source and destination strings do not overlap, so fix the code to avoid this. Modified Paths: -------------- debugger/src/dbm_gdb.c Modified: debugger/src/dbm_gdb.c 7 lines changed, 3 insertions(+), 4 deletions(-) =================================================================== @@ -225,14 +225,13 @@ static void gdb_input_write_line(const gchar *line) GIOStatus st; GError *err = NULL; gsize count; - + const char *p; char command[1000]; snprintf(command, sizeof command, "%s\n", line); - while (strlen(command)) + for (p = command; *p; p += count) { - st = g_io_channel_write_chars(gdb_ch_in, command, strlen(command), &count, &err); - strcpy(command, command + count); + st = g_io_channel_write_chars(gdb_ch_in, p, strlen(p), &count, &err); if (err || (st == G_IO_STATUS_ERROR) || (st == G_IO_STATUS_EOF)) { #ifdef DEBUG_OUTPUT -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
3
4
5
6
Older →
Jump to page:
1
2
3
4
5
6
Results per page:
10
25
50
100
200