List for cgit developers and users
 help / color / mirror / Atom feed
* Small patch makes cgit crash
@ 2016-10-07  9:27 sylvain
  2016-10-07  9:33 ` list
  0 siblings, 1 reply; 6+ messages in thread
From: sylvain @ 2016-10-07  9:27 UTC (permalink / raw)


Hi,

I've made a small patch to make cgit's summary layout look more like
gitweb's. It works but in some cases which I wasn't able to determine
the particulars it seems to crash and the clone url and the footer are
not displayed, e.g. :

 - not displayed: http://cgit.abstraction.fr/cgit.cgi/meld.git/
 - displayed: http://cgit.abstraction.fr/cgit.cgi/postgresql.git/

Here's the patch :

diff --git a/ui-summary.c b/ui-summary.c
index 8e81ac4..d84faad 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -51,14 +51,14 @@ void cgit_print_summary(void)

     cgit_print_layout_start();
     html("<table summary='repository info' class='list nowrap'>");
-    cgit_print_branches(ctx.cfg.summary_branches);
-    htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
-    cgit_print_tags(ctx.cfg.summary_tags);
     if (ctx.cfg.summary_log > 0) {
-        htmlf("<tr class='nohover'><td
colspan='%d'>&nbsp;</td></tr>", columns);
         cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
                    NULL, NULL, 0, 0, 0);
+        htmlf("<tr class='nohover'><td
colspan='%d'>&nbsp;</td></tr>", columns);
     }
+    cgit_print_tags(ctx.cfg.summary_tags);
+    htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
+    cgit_print_branches(ctx.cfg.summary_branches);
     urls = 0;
     cgit_add_clone_urls(print_url);
     html("</table>");

I would appreciate any help.

Best regards.

-- 
Sylvain Rabot <sylvain at abstraction.fr>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Small patch makes cgit crash
  2016-10-07  9:27 Small patch makes cgit crash sylvain
@ 2016-10-07  9:33 ` list
  2016-10-07  9:37   ` sylvain
  2016-10-07  9:51   ` list
  0 siblings, 2 replies; 6+ messages in thread
From: list @ 2016-10-07  9:33 UTC (permalink / raw)


Sylvain Rabot <sylvain at abstraction.fr> on Fri, 2016/10/07 11:27:
> I've made a small patch to make cgit's summary layout look more like
> gitweb's. It works but in some cases which I wasn't able to determine
> the particulars it seems to crash and the clone url and the footer are
> not displayed, e.g. :

Does it crash with the patch applied only?
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20161007/de325fb0/attachment.asc>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Small patch makes cgit crash
  2016-10-07  9:33 ` list
@ 2016-10-07  9:37   ` sylvain
  2016-10-07  9:51   ` list
  1 sibling, 0 replies; 6+ messages in thread
From: sylvain @ 2016-10-07  9:37 UTC (permalink / raw)


I did not find a case where it crashes without my patch.

On Fri, Oct 7, 2016 at 11:33 AM, Christian Hesse <list at eworm.de> wrote:
> Sylvain Rabot <sylvain at abstraction.fr> on Fri, 2016/10/07 11:27:
>> I've made a small patch to make cgit's summary layout look more like
>> gitweb's. It works but in some cases which I wasn't able to determine
>> the particulars it seems to crash and the clone url and the footer are
>> not displayed, e.g. :
>
> Does it crash with the patch applied only?
> --
> main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
> "CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
> putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}



-- 
Sylvain Rabot <sylvain at abstraction.fr>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Small patch makes cgit crash
  2016-10-07  9:33 ` list
  2016-10-07  9:37   ` sylvain
@ 2016-10-07  9:51   ` list
  2016-10-07 11:17     ` list
  1 sibling, 1 reply; 6+ messages in thread
From: list @ 2016-10-07  9:51 UTC (permalink / raw)


Christian Hesse <list at eworm.de> on Fri, 2016/10/07 11:33:
> Sylvain Rabot <sylvain at abstraction.fr> on Fri, 2016/10/07 11:27:
> > I've made a small patch to make cgit's summary layout look more like
> > gitweb's. It works but in some cases which I wasn't able to determine
> > the particulars it seems to crash and the clone url and the footer are
> > not displayed, e.g. :  
> 
> Does it crash with the patch applied only?

Ok, I can reproduce. For any reason info->subject is NULL when passed to
cgit_commit_link() in print_branch() (ui-refs.c, line 70).
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20161007/29d5954d/attachment.asc>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Small patch makes cgit crash
  2016-10-07  9:51   ` list
@ 2016-10-07 11:17     ` list
  2016-10-07 11:54       ` sylvain
  0 siblings, 1 reply; 6+ messages in thread
From: list @ 2016-10-07 11:17 UTC (permalink / raw)


Christian Hesse <list at eworm.de> on Fri, 2016/10/07 11:51:
> Christian Hesse <list at eworm.de> on Fri, 2016/10/07 11:33:
> > Sylvain Rabot <sylvain at abstraction.fr> on Fri, 2016/10/07 11:27:  
> > > I've made a small patch to make cgit's summary layout look more like
> > > gitweb's. It works but in some cases which I wasn't able to determine
> > > the particulars it seems to crash and the clone url and the footer are
> > > not displayed, e.g. :    
> > 
> > Does it crash with the patch applied only?  
> 
> Ok, I can reproduce. For any reason info->subject is NULL when passed to
> cgit_commit_link() in print_branch() (ui-refs.c, line 70).

The issue is calling free_commit_buffer() in cgit_print_log() (ui-log.c, line
509). That frees data we need later...
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20161007/113a8848/attachment.asc>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Small patch makes cgit crash
  2016-10-07 11:17     ` list
@ 2016-10-07 11:54       ` sylvain
  0 siblings, 0 replies; 6+ messages in thread
From: sylvain @ 2016-10-07 11:54 UTC (permalink / raw)


Indeed! I commented out line 509 and it now works.

Do you see any downside not freeing the commit buffer ?

On Fri, Oct 7, 2016 at 1:17 PM, Christian Hesse <list at eworm.de> wrote:
> Christian Hesse <list at eworm.de> on Fri, 2016/10/07 11:51:
>> Christian Hesse <list at eworm.de> on Fri, 2016/10/07 11:33:
>> > Sylvain Rabot <sylvain at abstraction.fr> on Fri, 2016/10/07 11:27:
>> > > I've made a small patch to make cgit's summary layout look more like
>> > > gitweb's. It works but in some cases which I wasn't able to determine
>> > > the particulars it seems to crash and the clone url and the footer are
>> > > not displayed, e.g. :
>> >
>> > Does it crash with the patch applied only?
>>
>> Ok, I can reproduce. For any reason info->subject is NULL when passed to
>> cgit_commit_link() in print_branch() (ui-refs.c, line 70).
>
> The issue is calling free_commit_buffer() in cgit_print_log() (ui-log.c, line
> 509). That frees data we need later...
> --
> main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
> "CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
> putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}



-- 
Sylvain Rabot <sylvain at abstraction.fr>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-07 11:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07  9:27 Small patch makes cgit crash sylvain
2016-10-07  9:33 ` list
2016-10-07  9:37   ` sylvain
2016-10-07  9:51   ` list
2016-10-07 11:17     ` list
2016-10-07 11:54       ` sylvain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).