summaryrefslogtreecommitdiff
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2012-05-22 23:42:32 (GMT)
committer Alan Coopersmith <alan.coopersmith@oracle.com>2012-05-23 02:07:20 (GMT)
commit11c3a104141e1a4946ad949dfb5514df0b66a031 (patch) (side-by-side diff)
tree4640b903bcd7c99badcee34421d647e176488b76
parentb16cc35e551860a0bff54c47b33317536ddeae52 (diff)
downloadlibXaw-master.zip
libXaw-master.tar.gz
Correct undefined behavior access to out of scope pointer contents.HEADmaster
This problem is triggered in gcc 4.7 DCE (dead code elimination). In the Xaw code, the local constant "String" is not guaranteed to have global scope. The problem was found when debugging the reason xedit built with gcc 4.7 would be very unstable, and that happens regardless of using a libXaw built with gcc 4.6. Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/Text.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text.c b/src/Text.c
index 72387e9..a1ae74a 100644
--- a/src/Text.c
+++ b/src/Text.c
@@ -3146,7 +3146,7 @@ _XawTextSetSelection(TextWidget ctx, XawTextPosition l, XawTextPosition r,
if (nelems == 1 && !strcmp (list[0], "none"))
return;
if (nelems == 0) {
- String defaultSel = "PRIMARY";
+ static String defaultSel = "PRIMARY";
list = &defaultSel;
nelems = 1;
}