diff options
author | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2012-05-22 20:42:32 -0300 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-05-22 19:07:20 -0700 |
commit | 11c3a104141e1a4946ad949dfb5514df0b66a031 (patch) | |
tree | 4640b903bcd7c99badcee34421d647e176488b76 | |
parent | b16cc35e551860a0bff54c47b33317536ddeae52 (diff) | |
download | xorg-lib-libXaw-11c3a104141e1a4946ad949dfb5514df0b66a031.tar.gz |
Correct undefined behavior access to out of scope pointer contents.
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>
-rw-r--r-- | src/Text.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |