diff --git a/Makefile.in b/Makefile.in index fa087ad67aff..3edc9ef16ec1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.1.4 +VERSION = 3.1.5 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/NEWS.md b/NEWS.md index ba528dbe907b..6d36f300d2b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,13 @@ # News +## 3.1.5 + +This is a production release that fixes the Chinese locales (which caused `bc` +to crash) and a crash caused by `bc` executing code when it should not have been +able to. + +***ALL USERS SHOULD UPGRADE.*** + ## 3.1.4 This is a production release that fixes one bug, changes two behaviors, and diff --git a/locales/zh_CN.GB18030.msg b/locales/zh_CN.GB18030.msg index e305f0d93471..36b150b2bcbf 100644 --- a/locales/zh_CN.GB18030.msg +++ b/locales/zh_CN.GB18030.msg @@ -103,9 +103,6 @@ $set 6 3 "无法打开文件。%s" 4 "文件不是ASCII: %s" 5 "路径是一个目录:%s" -6 "无效的命令行选项:'%c'(\"%s\")" - -$set 7 - -1 "选项需要一个参数:'%c'(\"%s\")" -2 "选项不需要参数。'%c'(\"%s\")" +6 "无效的命令行选项:\"%s\"" +7 "选项需要一个参数:'%c'(\"%s\")" +8 "选项不需要参数。'%c'(\"%s\")" diff --git a/locales/zh_CN.GB2312.msg b/locales/zh_CN.GB2312.msg index e305f0d93471..36b150b2bcbf 100644 --- a/locales/zh_CN.GB2312.msg +++ b/locales/zh_CN.GB2312.msg @@ -103,9 +103,6 @@ $set 6 3 "无法打开文件。%s" 4 "文件不是ASCII: %s" 5 "路径是一个目录:%s" -6 "无效的命令行选项:'%c'(\"%s\")" - -$set 7 - -1 "选项需要一个参数:'%c'(\"%s\")" -2 "选项不需要参数。'%c'(\"%s\")" +6 "无效的命令行选项:\"%s\"" +7 "选项需要一个参数:'%c'(\"%s\")" +8 "选项不需要参数。'%c'(\"%s\")" diff --git a/locales/zh_CN.GBK.msg b/locales/zh_CN.GBK.msg index e305f0d93471..36b150b2bcbf 100644 --- a/locales/zh_CN.GBK.msg +++ b/locales/zh_CN.GBK.msg @@ -103,9 +103,6 @@ $set 6 3 "无法打开文件。%s" 4 "文件不是ASCII: %s" 5 "路径是一个目录:%s" -6 "无效的命令行选项:'%c'(\"%s\")" - -$set 7 - -1 "选项需要一个参数:'%c'(\"%s\")" -2 "选项不需要参数。'%c'(\"%s\")" +6 "无效的命令行选项:\"%s\"" +7 "选项需要一个参数:'%c'(\"%s\")" +8 "选项不需要参数。'%c'(\"%s\")" diff --git a/locales/zh_CN.UTF-8.msg b/locales/zh_CN.UTF-8.msg index b2d0389f9fd6..4ca46786fc94 100644 --- a/locales/zh_CN.UTF-8.msg +++ b/locales/zh_CN.UTF-8.msg @@ -91,7 +91,7 @@ $set 5 5 "閫掑綊璇诲彇()璋冪敤" 6 "鍙橀噺鎴栨暟缁勫厓绱犳槸閿欒鐨勭被鍨" 7 "鍫嗘爤鐨勫厓绱犲お灏" -8 "鍙傛暟鏁伴噺閿欒锛涢渶瑕%zu锛屾湁%zu" +8 "鍙傛暟鏁伴噺閿欒锛氶渶瑕%zu锛屾湁%zu" 9 "鏈畾涔夌殑鍑芥暟锛%s()" 10 鈥滀笉鑳藉湪琛ㄨ揪寮忎腑浣跨敤绌哄尖 @@ -100,12 +100,9 @@ $set 6 1 "鍐呭瓨鍒嗛厤澶辫触" 2 "I/O閿欒" -3 "鏃犳硶鎵撳紑鏂囦欢銆%s" +3 "鏃犳硶鎵撳紑鏂囦欢锛%s" 4 "鏂囦欢涓嶆槸ASCII: %s" 5 "璺緞鏄竴涓洰褰曪細%s" -6 "鏃犳晥鐨勫懡浠よ閫夐」锛'%c'(\"%s\")" - -$set 7 - -1 "閫夐」闇瑕佷竴涓弬鏁帮細'%c'(\"%s\")" -2 "閫夐」涓嶉渶瑕佸弬鏁般'%c'(\"%s\")" +6 "鏃犳晥鐨勫懡浠よ閫夐」锛歕"%s\"" +7 "閫夐」闇瑕佷竴涓弬鏁帮細'%c'(\"%s\")" +8 "閫夐」涓嶉渶瑕佸弬鏁般'%c'(\"%s\")" diff --git a/locales/zh_CN.eucCN.msg b/locales/zh_CN.eucCN.msg index e305f0d93471..36b150b2bcbf 100644 --- a/locales/zh_CN.eucCN.msg +++ b/locales/zh_CN.eucCN.msg @@ -103,9 +103,6 @@ $set 6 3 "无法打开文件。%s" 4 "文件不是ASCII: %s" 5 "路径是一个目录:%s" -6 "无效的命令行选项:'%c'(\"%s\")" - -$set 7 - -1 "选项需要一个参数:'%c'(\"%s\")" -2 "选项不需要参数。'%c'(\"%s\")" +6 "无效的命令行选项:\"%s\"" +7 "选项需要一个参数:'%c'(\"%s\")" +8 "选项不需要参数。'%c'(\"%s\")" diff --git a/src/program.c b/src/program.c index 1a8176c76f96..3c2544f8a61f 100644 --- a/src/program.c +++ b/src/program.c @@ -1271,12 +1271,13 @@ static void bc_program_divmod(BcProgram *p) { BcNum *n1, *n2; size_t req; + bc_vec_expand(&p->results, p->results.len + 2); + + // We don't need to update the pointer because + // the capacity is enough due to the line above. res2 = bc_program_prepResult(p); res = bc_program_prepResult(p); - // Update the pointer, just in case. - res2 = bc_vec_item_rev(&p->results, 1); - bc_program_binOpPrep(p, &opd1, &n1, &opd2, &n2, 2); req = bc_num_mulReq(n1, n2, BC_PROG_SCALE(p)); diff --git a/src/vm.c b/src/vm.c index 9818ce4f35f4..e15b1398734e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -464,7 +464,7 @@ static void bc_vm_process(const char *text) { while (BC_PARSE_CAN_PARSE(vm.prs)) vm.parse(&vm.prs); - bc_program_exec(&vm.prog); + if(BC_IS_DC || !BC_PARSE_NO_EXEC(&vm.prs)) bc_program_exec(&vm.prog); assert(BC_IS_DC || vm.prog.results.len == 0);