diff options
author | joerg <joerg@pkgsrc.org> | 2015-09-12 16:56:47 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2015-09-12 16:56:47 +0000 |
commit | c070819581845e3f5997c6493dc9f3e1273101be (patch) | |
tree | 47e34c164cc6f3bb4c158259bdf59e7c9329215d /lang/openjdk8/patches | |
parent | 729f6db35155d535760561391f8fe7d7d1ea3b7c (diff) | |
download | pkgsrc-c070819581845e3f5997c6493dc9f3e1273101be.tar.gz |
Avoid UB by left shift of negative values.
Diffstat (limited to 'lang/openjdk8/patches')
-rw-r--r-- | lang/openjdk8/patches/patch-hotspot_src_share_vm_oops_klass.hpp | 20 | ||||
-rw-r--r-- | lang/openjdk8/patches/patch-hotspot_src_share_vm_opto_library__call.cpp | 17 |
2 files changed, 37 insertions, 0 deletions
diff --git a/lang/openjdk8/patches/patch-hotspot_src_share_vm_oops_klass.hpp b/lang/openjdk8/patches/patch-hotspot_src_share_vm_oops_klass.hpp new file mode 100644 index 00000000000..830683c5edf --- /dev/null +++ b/lang/openjdk8/patches/patch-hotspot_src_share_vm_oops_klass.hpp @@ -0,0 +1,20 @@ +$NetBSD: patch-hotspot_src_share_vm_oops_klass.hpp,v 1.1 2015/09/12 16:56:48 joerg Exp $ + +Left shift of negative values is UB. + +--- hotspot/src/share/vm/oops/klass.hpp.orig 2015-09-03 15:25:36.000000000 +0000 ++++ hotspot/src/share/vm/oops/klass.hpp +@@ -352,11 +352,11 @@ protected: + } + static bool layout_helper_is_typeArray(jint lh) { + // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); +- return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); ++ return (juint)lh >= ((juint)_lh_array_tag_type_value << _lh_array_tag_shift); + } + static bool layout_helper_is_objArray(jint lh) { + // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift); +- return (jint)lh < (jint)(_lh_array_tag_type_value << _lh_array_tag_shift); ++ return (jint)lh < (jint)((juint)_lh_array_tag_type_value << _lh_array_tag_shift); + } + static int layout_helper_header_size(jint lh) { + assert(lh < (jint)_lh_neutral_value, "must be array"); diff --git a/lang/openjdk8/patches/patch-hotspot_src_share_vm_opto_library__call.cpp b/lang/openjdk8/patches/patch-hotspot_src_share_vm_opto_library__call.cpp new file mode 100644 index 00000000000..f6bb0b35abc --- /dev/null +++ b/lang/openjdk8/patches/patch-hotspot_src_share_vm_opto_library__call.cpp @@ -0,0 +1,17 @@ +$NetBSD: patch-hotspot_src_share_vm_opto_library__call.cpp,v 1.1 2015/09/12 16:56:48 joerg Exp $ + +Left shift of negative values is UB. + +--- hotspot/src/share/vm/opto/library_call.cpp.orig 2015-09-03 15:27:49.000000000 +0000 ++++ hotspot/src/share/vm/opto/library_call.cpp +@@ -3750,8 +3750,8 @@ Node* LibraryCallKit::generate_array_gua + } + // Now test the correct condition. + jint nval = (obj_array +- ? ((jint)Klass::_lh_array_tag_type_value +- << Klass::_lh_array_tag_shift) ++ ? (jint)((juint)Klass::_lh_array_tag_type_value ++ << Klass::_lh_array_tag_shift) + : Klass::_lh_neutral_value); + Node* cmp = _gvn.transform(new(C) CmpINode(layout_val, intcon(nval))); + BoolTest::mask btest = BoolTest::lt; // correct for testing is_[obj]array |