Skip to content

Commit 8ee1c90

Browse files
harukasanclaude
andcommitted
Zero DVI::Text::Line cells beyond the active columns
- read_line fills only the active columns, so a Line held across a resolution switch would write heap garbage back through write_line Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 6a47b0a commit 8ee1c90

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • mrbgems/picoruby-dvi/src/mruby

mrbgems/picoruby-dvi/src/mruby/dvi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,10 @@ mrb_dvi_text_read_line(mrb_state *mrb, mrb_value klass)
605605
if (row < 0 || row >= dvi_text_get_rows()) mrb_raise(mrb, E_ARGUMENT_ERROR, "row out of range");
606606
struct dvi_text_line *line =
607607
(struct dvi_text_line *)mrb_malloc(mrb, sizeof(struct dvi_text_line));
608+
// read_line fills only the active columns. Zero the rest so a Line
609+
// written back after a resolution switch carries blanks, not heap
610+
// garbage.
611+
memset(line, 0, sizeof(struct dvi_text_line));
608612
dvi_text_read_line(row, line->cells);
609613
return mrb_obj_value(mrb_data_object_alloc(mrb, class_Line, line, &dvi_text_line_type));
610614
}

0 commit comments

Comments
 (0)