Skip to content

Commit

Permalink
Too much stack allocation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rlpowell committed Dec 9, 2020
1 parent 398bbc0 commit 0b7c9d8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
New in version 0.43
===================

- reduced the size of some of the char[] arrays to avoid hitting
stack size limits

New in version 0.42
===================

Expand Down
6 changes: 3 additions & 3 deletions build-in-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ make all
DESTDIR=build/ make install
rm -rf build/usr/lib/.build-id
cp find_lojban.pl build/usr/local/bin/find_lojban
rm -f jbofihe-0.42-1.x86_64.rpm
fpm -s dir -t rpm -n jbofihe -v 0.42 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
rpm -qpl jbofihe-0.42-1.x86_64.rpm | sort
rm -f jbofihe-0.43-1.x86_64.rpm
fpm -s dir -t rpm -n jbofihe -v 0.43 --rpm-rpmbuild-define "_build_id_links none" -C build/ usr/local
rpm -qpl jbofihe-0.43-1.x86_64.rpm | sort
26 changes: 13 additions & 13 deletions output.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static void translate_bai (TreeNode *x, char *eng)/*{{{*/
{
XBaiConversion *baiconv;
XTenseCtx *xtc;
char buffer[65536], *trans;
char buffer[1024], *trans;

eng[0] = 0;
buffer[0] = 0;
Expand Down Expand Up @@ -336,7 +336,7 @@ static void get_cmavo_text_inside_node_internal(TreeNode *x, char *sofar)/*{{{*/
/*}}}*/
static char * get_cmavo_text_inside_node(TreeNode *x)/*{{{*/
{
static char buffer[65536];
static char buffer[1024];
buffer[0] = 0;
get_cmavo_text_inside_node_internal(x, buffer);
return buffer;
Expand Down Expand Up @@ -453,7 +453,7 @@ static void translate_indicator (TreeNode *x, char *loj, char *eng)/*{{{*/
/*}}}*/
static char * translate_tense_in_context(char *text, enum tense_contexts ctx)/*{{{*/
{
char buffer[65536];
char buffer[1024];
char *trans;

strcpy(buffer, text);
Expand Down Expand Up @@ -504,7 +504,7 @@ static char * translate_tense_in_context(char *text, enum tense_contexts ctx)/*{
static void translate_tense (TreeNode *x, char *eng)/*{{{*/
{
XTenseCtx *ctx;
char buffer[65536], *trans;
char buffer[1024], *trans;

eng[0] = 0;
ctx = prop_tense_ctx(x, NO);
Expand Down Expand Up @@ -553,7 +553,7 @@ static void translate_time_offset (TreeNode *x, char *loj, char *eng)/*{{{*/
if (trans) {
strcpy(eng, trans);
} else {
char engbuf[65536];
char engbuf[1024];
engbuf[0] = 0;
trans = translate(cmavo_table[pu->data.cmavo.code].cmavo);
strcat(engbuf, trans ? trans : "?");
Expand All @@ -580,7 +580,7 @@ static void translate_time_offset (TreeNode *x, char *loj, char *eng)/*{{{*/
static void translate_jai (TreeNode *x, char *eng)/*{{{*/
{
XGlosstype *xgt;
char buffer[65536], *trans;
char buffer[1024], *trans;

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

case N_ZO:
{
char buffer[65536];
char buffer[1024];
sprintf(loj, "zo %s", x->data.zo.text);
attempt_translation(x->data.zo.text, buffer);
sprintf(eng, "\"%s\"", buffer);
Expand Down Expand Up @@ -869,7 +869,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
break;/*}}}*/
case TTT_JAITAG:/*{{{*/
{
char transbuf[65536];
char transbuf[1024];
(drv->start_tag)();
(drv->write_partial_tag_text)("jai+<tag>1: (");
output_internal(tag->jaitag.tag, SHOW_TAG_TRANS);
Expand Down Expand Up @@ -900,7 +900,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
/*}}}*/
case TTT_ME:/*{{{*/
{
char *trans, transbuf[65536];
char *trans, transbuf[1024];
(drv->start_tag)();
trans = adv_translate("me", tag->pos, TCX_TAG);
sprintf(transbuf, trans, tag->me.sumti->data.nonterm.number);
Expand All @@ -910,7 +910,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
break;/*}}}*/
case TTT_NUMBERMOI:/*{{{*/
{
char *trans, lojbuf[65536], transbuf[65536];
char *trans, lojbuf[1024], transbuf[1024];
int code;
int norl_code;
char *cmavo;
Expand Down Expand Up @@ -984,7 +984,7 @@ static void output_term(TreeNode *x, WhatToShow what)/*{{{*/
/*}}}*/
static void output_simple_time_offset(TreeNode *x, WhatToShow what)/*{{{*/
{
char loj[65536], eng[65536];
char loj[1024], eng[1024];
int i, n;

loj[0] = 0;
Expand Down Expand Up @@ -1277,7 +1277,7 @@ static void output_clustered(TreeNode *x, WhatToShow what)/*{{{*/
/*}}}*/
static void output_internal(TreeNode *x, WhatToShow what)/*{{{*/
{
char loj[65536], eng[65536];
char loj[1024], eng[1024];
int i, n;

if (x->type == N_NONTERM) {/*{{{*/
Expand Down Expand Up @@ -1440,7 +1440,7 @@ static void output_internal(TreeNode *x, WhatToShow what)/*{{{*/
/*}}}*/
} else {/*{{{*/
/* Terminal token */
char lojbuf[65536];
char lojbuf[1024];

lojbuf[0] = 0;

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
char version_string[] = "0.42";
char version_string[] = "0.43";

0 comments on commit 0b7c9d8

Please sign in to comment.