poe

Уређивач .po фајлова
git clone https://git.sr.ht/~strahinja/poe
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување f145e0ce08c7c571cc6f35b3011e21618a984c82
родитељ 60188e692e3f6b97503bd2768750f10942fe73fd
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Tue, 17 Mar 2026 19:00:24 +0100

Bugfix: Empty msgstrs causing SEGV

Diffstat:
Mpo.c | 17++++++++++++++---
Mpoe.c | 1+
измењених датотека: 2, додавања: 15(+), брисања: 3(-)

diff --git a/po.c b/po.c @@ -714,7 +714,18 @@ parse_po_line(const char* line, struct DrawState* dstate, goto parse_po_cleanup; parse_po_empty_token: - if (*pstate & PS_COMMENT_TRAN) + if (*pstate & PS_MSGSTR) + { + if (u32_set_msgstr(dstate, *current_entry, empty_string, 0, 1)) + goto parse_po_line_alloc_error; + } + else if (*pstate & PS_MSGSTR_ARRAY) + { + if (u32_set_msgstr(dstate, *current_entry, empty_string, + *msgstr_index, 1)) + goto parse_po_line_alloc_error; + } + else if (*pstate & PS_COMMENT_TRAN) { if (u32_add_comment(*current_entry, empty_string)) goto parse_po_line_alloc_error; @@ -1049,8 +1060,8 @@ save_msgid_plural(FILE* output, struct DrawState* state, assert((output != NULL) && (state != NULL) && (current != NULL)); num_lines = u32_lines_in_string(current->msgid_plural, 1, wrap_width); if ((num_lines > 1) - || u32_strlen(current->msgid_plural) - + strlen("msgid_plural \"") + 1 + || u32_strlen(current->msgid_plural) + strlen("msgid_plural \"") + + 1 > (size_t)literal_break_threshold) { pumsgid = current->msgid_plural; diff --git a/poe.c b/poe.c @@ -1418,6 +1418,7 @@ load_msgstr(struct DrawState* state) for (i = 0; i < num_lines; i++) { init_bufferline(pnewbuf); + assert(current->msgstr_size != NULL); size = MAX(current->msgstr_size[msgstr_index], LINE_DEFAULT); newtext = calloc(size, sizeof(uint32_t)); if (!newtext)