Skip to content

Commit 0b7c9d8

Browse files
committed
Too much stack allocation
jbofihe was crashing on stack ulimits when run with -H. These variables all seem to be used to store only single words, so this should be OK.
1 parent 398bbc0 commit 0b7c9d8

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
New in version 0.43
2+
===================
3+
4+
- reduced the size of some of the char[] arrays to avoid hitting
5+
stack size limits
6+
17
New in version 0.42
28
===================
39

build-in-container.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ make all
1111
DESTDIR=build/ make install
1212
rm -rf build/usr/lib/.build-id
1313
cp find_lojban.pl build/usr/local/bin/find_lojban
14-
rm -f jbofihe-0.42-1.x86_64.rpm
15-
fpm -s dir -t rpm -n jbofihe -v 0.42 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
16-
rpm -qpl jbofihe-0.42-1.x86_64.rpm | sort
14+
rm -f jbofihe-0.43-1.x86_64.rpm
15+
fpm -s dir -t rpm -n jbofihe -v 0.43 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
16+
rpm -qpl jbofihe-0.43-1.x86_64.rpm | sort

output.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void translate_bai (TreeNode *x, char *eng)/*{{{*/
186186
{
187187
XBaiConversion *baiconv;
188188
XTenseCtx *xtc;
189-
char buffer[65536], *trans;
189+
char buffer[1024], *trans;
190190

191191
eng[0] = 0;
192192
buffer[0] = 0;
@@ -336,7 +336,7 @@ static void get_cmavo_text_inside_node_internal(TreeNode *x, char *sofar)/*{{{*/
336336
/*}}}*/
337337
static char * get_cmavo_text_inside_node(TreeNode *x)/*{{{*/
338338
{
339-
static char buffer[65536];
339+
static char buffer[1024];
340340
buffer[0] = 0;
341341
get_cmavo_text_inside_node_internal(x, buffer);
342342
return buffer;
@@ -453,7 +453,7 @@ static void translate_indicator (TreeNode *x, char *loj, char *eng)/*{{{*/
453453
/*}}}*/
454454
static char * translate_tense_in_context(char *text, enum tense_contexts ctx)/*{{{*/
455455
{
456-
char buffer[65536];
456+
char buffer[1024];
457457
char *trans;
458458

459459
strcpy(buffer, text);
@@ -504,7 +504,7 @@ static char * translate_tense_in_context(char *text, enum tense_contexts ctx)/*{
504504
static void translate_tense (TreeNode *x, char *eng)/*{{{*/
505505
{
506506
XTenseCtx *ctx;
507-
char buffer[65536], *trans;
507+
char buffer[1024], *trans;
508508

509509
eng[0] = 0;
510510
ctx = prop_tense_ctx(x, NO);
@@ -553,7 +553,7 @@ static void translate_time_offset (TreeNode *x, char *loj, char *eng)/*{{{*/
553553
if (trans) {
554554
strcpy(eng, trans);
555555
} else {
556-
char engbuf[65536];
556+
char engbuf[1024];
557557
engbuf[0] = 0;
558558
trans = translate(cmavo_table[pu->data.cmavo.code].cmavo);
559559
strcat(engbuf, trans ? trans : "?");
@@ -580,7 +580,7 @@ static void translate_time_offset (TreeNode *x, char *loj, char *eng)/*{{{*/
580580
static void translate_jai (TreeNode *x, char *eng)/*{{{*/
581581
{
582582
XGlosstype *xgt;
583-
char buffer[65536], *trans;
583+
char buffer[1024], *trans;
584584

585585
strcpy(buffer, cmavo_table[x->data.cmavo.code].cmavo);
586586
eng[0] = 0;
@@ -775,7 +775,7 @@ static void get_lojban_word_and_translation (TreeNode *x, char *loj, char *eng)/
775775

776776
case N_ZO:
777777
{
778-
char buffer[65536];
778+
char buffer[1024];
779779
sprintf(loj, "zo %s", x->data.zo.text);
780780
attempt_translation(x->data.zo.text, buffer);
781781
sprintf(eng, "\"%s\"", buffer);
@@ -869,7 +869,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
869869
break;/*}}}*/
870870
case TTT_JAITAG:/*{{{*/
871871
{
872-
char transbuf[65536];
872+
char transbuf[1024];
873873
(drv->start_tag)();
874874
(drv->write_partial_tag_text)("jai+<tag>1: (");
875875
output_internal(tag->jaitag.tag, SHOW_TAG_TRANS);
@@ -900,7 +900,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
900900
/*}}}*/
901901
case TTT_ME:/*{{{*/
902902
{
903-
char *trans, transbuf[65536];
903+
char *trans, transbuf[1024];
904904
(drv->start_tag)();
905905
trans = adv_translate("me", tag->pos, TCX_TAG);
906906
sprintf(transbuf, trans, tag->me.sumti->data.nonterm.number);
@@ -910,7 +910,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
910910
break;/*}}}*/
911911
case TTT_NUMBERMOI:/*{{{*/
912912
{
913-
char *trans, lojbuf[65536], transbuf[65536];
913+
char *trans, lojbuf[1024], transbuf[1024];
914914
int code;
915915
int norl_code;
916916
char *cmavo;
@@ -984,7 +984,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
984984
/*}}}*/
985985
static void output_simple_time_offset(TreeNode *x, WhatToShow what)/*{{{*/
986986
{
987-
char loj[65536], eng[65536];
987+
char loj[1024], eng[1024];
988988
int i, n;
989989

990990
loj[0] = 0;
@@ -1277,7 +1277,7 @@ static void output_clustered(TreeNode *x, WhatToShow what)/*{{{*/
12771277
/*}}}*/
12781278
static void output_internal(TreeNode *x, WhatToShow what)/*{{{*/
12791279
{
1280-
char loj[65536], eng[65536];
1280+
char loj[1024], eng[1024];
12811281
int i, n;
12821282

12831283
if (x->type == N_NONTERM) {/*{{{*/
@@ -1440,7 +1440,7 @@ static void output_internal(TreeNode *x, WhatToShow what)/*{{{*/
14401440
/*}}}*/
14411441
} else {/*{{{*/
14421442
/* Terminal token */
1443-
char lojbuf[65536];
1443+
char lojbuf[1024];
14441444

14451445
lojbuf[0] = 0;
14461446

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
char version_string[] = "0.42";
1+
char version_string[] = "0.43";

0 commit comments

Comments
 (0)