Bug 486334 - Endless recursive loop in egg_markdown_to_text_line_formatter()
Summary: Endless recursive loop in egg_markdown_to_text_line_formatter()
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-packagekit
Version: rawhide
Hardware: x86_64
OS: Linux
low
high
Target Milestone: ---
Assignee: Richard Hughes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-19 12:59 UTC by Tomáš Bžatek
Modified: 2015-03-03 22:34 UTC (History)
3 users (show)

Fixed In Version: gnome-packagekit-0.4.4-2.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-02 10:55:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tomáš Bžatek 2009-02-19 12:59:16 UTC
Description of problem:
gpk-application recursively calls egg_markdown_to_text_line_formatter() which makes the string longer and longer and never ends...

Version-Release number of selected component (if applicable):
  gnome-packagekit-0.4.3-1.fc11.x86_64
  PackageKit-0.4.3-1.fc11.x86_64
  gcc-4.4.0-0.20.x86_64

Steps to Reproduce:
1. run gpk-application
2. search for 'geeqie' or any other package
3. tick the checkbox like you want to install that package
4. UI freezes, memory usage increases, ends with kill from OOM killer

Additional info:
- might be related to gcc-4.4.0, try to lower optimizations (-O0)


gnome-packagekit-0.4.3/src/egg-markdown.c

...
#3201 0x000000000041481d in egg_markdown_to_text_line_formatter (
    line=0x8ce020 "* This software is currently in alpha state * This software is currently in alpha state * This software is currently in alpha state * This software is currently in alpha state * This software is curre"..., 
    formatter=0x42ac4f "**", left=0x432032 "", right=0x432032 "") at egg-markdown.c:318
#3202 0x000000000041481d in egg_markdown_to_text_line_formatter (
    line=0x8cddf0 "* This software is currently in alpha state * This software is currently in alpha state * This software is currently in alpha state * This software is currently in alpha state *** This software is cur"..., 
    formatter=0x42ac4f "**", left=0x432032 "", right=0x432032 "") at egg-markdown.c:318
#3203 0x000000000041481d in egg_markdown_to_text_line_formatter (
    line=0x8cdc00 "* This software is currently in alpha state * This software is currently in alpha state * This software is currently in alpha state *** This software is currently in alpha state ***", formatter=0x42ac4f "**", 
    left=0x432032 "", right=0x432032 "") at egg-markdown.c:318
#3204 0x000000000041481d in egg_markdown_to_text_line_formatter (line=0x7c9650 "* This software is currently in alpha state * This software is currently in alpha state *** This software is currently in alpha state ***", 
    formatter=0x42ac4f "**", left=0x432032 "", right=0x432032 "") at egg-markdown.c:318
#3205 0x000000000041481d in egg_markdown_to_text_line_formatter (line=0x7c9530 "* This software is currently in alpha state *** This software is currently in alpha state ***", formatter=0x42ac4f "**", left=0x432032 "", 
    right=0x432032 "") at egg-markdown.c:318
#3206 0x000000000041481d in egg_markdown_to_text_line_formatter (line=0x8bc900 "*** This software is currently in alpha state ***", formatter=0x42ac4f "**", left=0x432032 "", right=0x432032 "") at egg-markdown.c:318
#3207 0x00000000004148da in egg_markdown_to_text_line_format (line=<value optimized out>, self=<value optimized out>) at egg-markdown.c:340
#3208 egg_markdown_flush_pending (self=0x6c4000) at egg-markdown.c:454
#3209 0x0000000000414ea6 in egg_markdown_to_text_line_process (line=<value optimized out>, self=<value optimized out>) at egg-markdown.c:487
#3210 egg_markdown_parse (self=0x6c4000, markdown=<value optimized out>) at egg-markdown.c:698
#3211 0x0000000000412298 in gpk_application_text_format_display (ascii=<value optimized out>, application=<value optimized out>) at gpk-application.c:940
#3212 gpk_application_details_cb (client=<value optimized out>, details=0x8e0cd0, application=0x6bf050) at gpk-application.c:1019
#3213 0x00007ffff69d18fe in IA__g_closure_invoke (closure=0x71afd0, return_value=0x0, n_param_values=2, param_values=0x8cd790, invocation_hint=0x7fffffffd6c0) at gclosure.c:767

#3214 0x00007ffff69e7f08 in signal_emit_unlocked_R (node=0x70e0c0, detail=<value optimized out>, instance=<value optimized out>, emission_return=<value optimized out>, instance_and_params=<value optimized out>) at gsignal.c:3244
#3215 0x00007ffff69e92ee in IA__g_signal_emit_valist (instance=0x6bf650, signal_id=<value optimized out>, detail=0, var_args=0x7fffffffd8b0) at gsignal.c:2977

Comment 1 Richard Hughes 2009-02-19 13:58:10 UTC
I've committed this to git:

commit 68be403108adee13ece04140371a559c83c33a61
Author: Richard Hughes <hughsie>
Date:   Thu Feb 19 13:57:28 2009 +0000

    bugfix: fix infinite recursion when we try to format invalid markdown. Fixes rh#486334

diff --git a/src/egg-markdown.c b/src/egg-markdown.c
index 75b4359..fcc0519 100644
--- a/src/egg-markdown.c
+++ b/src/egg-markdown.c
@@ -302,7 +302,7 @@ egg_markdown_to_text_line_formatter (const gchar *line, const gchar *formatter,
        str1 = egg_markdown_strstr_spaces (copy, formatter);
        if (str1 != NULL) {
                *str1 = '\0';
-               str2 = egg_markdown_strstr_spaces (str1+1, formatter);
+               str2 = egg_markdown_strstr_spaces (str1+len, formatter);
                if (str2 != NULL) {
                        *str2 = '\0';
                        middle = str1 + len;

Comment 2 Richard Hughes 2009-02-19 14:11:45 UTC
commit cf7531d78af4d754a9705b6df9f22769bff77cb2
Author: Richard Hughes <hughsie>
Date:   Thu Feb 19 14:11:28 2009 +0000

    trivial: add some unit tests to EggMarkup

Comment 3 Richard Hughes 2009-02-19 14:12:43 UTC
I'm doing a new upstream release on Monday and will update rawhide then. Thanks for reporting this bug, and doing the debugging -- appreciated.

Comment 4 Tomáš Bžatek 2009-03-02 10:55:05 UTC
Looks to be fixed in gnome-packagekit-0.4.4-2.fc11.x86_64
Closing.


Note You need to log in before you can comment on or make changes to this bug.