groff/0012-Initialize-x-and-y-elements-of-the-here-structure.patch
Lukas Javorsky 110a111914 Fixing SAST reports
Resolves: RHEL-45003
2024-08-21 11:57:10 +00:00

37 lines
1.1 KiB
Diff

From afd4d3247df46f5ec21a86627203234f37d750ee Mon Sep 17 00:00:00 2001
From: Lukas Javorsky <ljavorsk@redhat.com>
Date: Mon, 12 Aug 2024 15:52:14 +0200
Subject: [PATCH 6/7] Initialize "x" and "y" elements of the "here" structure
Using uninitialized variables in the "path::follow" function could cause
an undefined behavior.
---
src/preproc/pic/object.cpp | 4 ++++
1 file changed, 4 insertions(+)
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;
--
2.44.0