gbranden pushed a commit to branch master
in repository groff.

commit 282e15e0709153337597b613bdc825699da6aace
Author: Lukas Javorsky <[email protected]>
AuthorDate: Mon Aug 12 15:52:14 2024 +0200

    [pic]: Fix Savannah #66080 (uninit'd struct mbrs).
    
    * src/preproc/pic/object.cpp (object_spec::position_rectangle)
      (object_spec::make_line): Initialize "x" and "y" elements of the
      `here` structure.  Using uninitialized variables in `path::follow()`
      could cause undefined behavior.
    
    Fixes <https://savannah.gnu.org/bugs/?66080>.
---
 ChangeLog                  | 9 +++++++++
 src/preproc/pic/object.cpp | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 5d42caf92..bd47d77ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-14  Lukas Javorsky <[email protected]>
+
+       * src/preproc/pic/object.cpp (object_spec::position_rectangle)
+       (object_spec::make_line): Initialize "x" and "y" elements of the
+       `here` structure.  Using uninitialized variables in
+       `path::follow()` could cause undefined behavior.
+
+       Fixes <https://savannah.gnu.org/bugs/?66080>.
+
 2024-10-17  G. Branden Robinson <[email protected]>
 
        * doc/pic.ms: Fix omission of `linethick` variable from
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index d0b648c27..b197a02fa 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -891,6 +891,8 @@ int object_spec::position_rectangle(rectangle_object *p,
     if (flags & HAS_WITH) {
       place offset;
       place here;
+      here.x = 0;
+      here.y = 0;
       here.obj = p;
       if (!with->follow(here, &offset))
        return 0;
@@ -1512,6 +1514,8 @@ linear_object *object_spec::make_line(position *curpos, 
direction *dirp)
     position pos = at;
     place offset;
     place here;
+    here.x = 0;
+    here.y = 0;
     here.obj = &tmpobj;
     if (!with->follow(here, &offset))
       return 0;

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to