Control: tags -1 + patch Gilles Filippini a écrit le 25/03/2017 à 17:20 : > On Sat, 4 Mar 2017 20:06:36 +0100 gregor herrmann <[email protected]> wrote: >> On Sat, 25 Feb 2017 16:07:03 +0200, Adrian Bunk wrote: >> >>> Source: shiboken >>> Version: 1.2.2-3 >>> Severity: serious >>> >>> https://buildd.debian.org/status/package.php?p=shiboken&suite=sid >>> >> >> FWIW, the package currently builds fine for me in an i386 sid >> cowbuilder chroot (and an amd64 machine). > > Strangely it builds fine in an i386 sbuild chroot, but it fails > reproducibly on porter box barriere.debian.org.
The failing testcase seems flawed:
> class CollectorOtherObjectType(unittest.TestCase):
> '''Test cases for Collector << OtherObjectType'''
> ...
> def testOtherReversal(self):
> '''Collector << OtherObjectType # libother << operator'''
> collector = Collector()
> obj = OtherObjectType()
> collector << obj
> self.assertEqual(collector.items()[0], obj.identifier() * 2)
Collector stores unsigned long ids:
> class LIBSAMPLE_API Collector
> {
> public:
> Collector() {}
> virtual ~Collector() {}
>
> void clear();
>
> Collector& operator<<(unsigned long item);
>
> Collector& operator<<(const ObjectType *);
>
> std::list<unsigned long> items();
> int size();
> ...
OtherObjectType inherits identifier() from ObjectType:
> inline unsigned long identifier() const { return
> reinterpret_cast<unsigned long>(this); }
And << operator for OtherObjectType strores the objects's id * 2 into the
collector:
> Collector&
> operator<<(Collector& collector, const OtherObjectType& obj)
> {
> std::cout << sizeof(&obj) << std::endl;
> collector << obj.identifier()*2;
> return collector;
> }
The problem is that the *2 operation may causes an overflow when the results is
> ULONG_MAX.
To fix the test, either drop the *2, or store unsigned long long into
Collector.items(). The easiest being the former, IMHO.
Patch attached.
Thanks,
_g.
diff -Nru shiboken-1.2.2/debian/changelog shiboken-1.2.2/debian/changelog --- shiboken-1.2.2/debian/changelog 2016-07-09 14:34:52.000000000 +0000 +++ shiboken-1.2.2/debian/changelog 2017-03-26 14:09:16.000000000 +0000 @@ -1,3 +1,11 @@ +shiboken (1.2.2-3.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * New patch fix-collector_external_operator_test.patch to fix an + unsigned long overflow in testcase collector_external_operator_test.py + + -- Gilles Filippini <[email protected]> Sun, 26 Mar 2017 14:09:16 +0000 + shiboken (1.2.2-3) unstable; urgency=medium [ Ondřej Nový ] diff -Nru shiboken-1.2.2/debian/patches/fix-collector_external_operator_test.patch shiboken-1.2.2/debian/patches/fix-collector_external_operator_test.patch --- shiboken-1.2.2/debian/patches/fix-collector_external_operator_test.patch 1970-01-01 00:00:00.000000000 +0000 +++ shiboken-1.2.2/debian/patches/fix-collector_external_operator_test.patch 2017-03-26 14:09:16.000000000 +0000 @@ -0,0 +1,29 @@ +Description: don't *2 the object's identifier because this causes an + unsigned long overflow when the result is > ULONG_MAX +Author: Gilles Filippini <[email protected]> +Bug-Debian: http://bugs.debian.org/856133 +Index: shiboken-1.2.2/tests/libother/otherobjecttype.cpp +=================================================================== +--- shiboken-1.2.2.orig/tests/libother/otherobjecttype.cpp ++++ shiboken-1.2.2/tests/libother/otherobjecttype.cpp +@@ -25,6 +25,6 @@ + Collector& + operator<<(Collector& collector, const OtherObjectType& obj) + { +- collector << obj.identifier()*2; ++ collector << obj.identifier(); + return collector; + } +Index: shiboken-1.2.2/tests/otherbinding/collector_external_operator_test.py +=================================================================== +--- shiboken-1.2.2.orig/tests/otherbinding/collector_external_operator_test.py ++++ shiboken-1.2.2/tests/otherbinding/collector_external_operator_test.py +@@ -46,7 +46,7 @@ class CollectorOtherObjectType(unittest. + collector = Collector() + obj = OtherObjectType() + collector << obj +- self.assertEqual(collector.items()[0], obj.identifier() * 2) ++ self.assertEqual(collector.items()[0], obj.identifier()) + + if __name__ == '__main__': + unittest.main() diff -Nru shiboken-1.2.2/debian/patches/series shiboken-1.2.2/debian/patches/series --- shiboken-1.2.2/debian/patches/series 2016-07-09 14:24:52.000000000 +0000 +++ shiboken-1.2.2/debian/patches/series 2017-03-26 14:03:45.000000000 +0000 @@ -6,3 +6,4 @@ fix_py3_expect.patch pkg-config-depend-on-python.patch 0008-Cast-ifstream-to-bool-explicitely-to-work-with-GCC-6.patch +fix-collector_external_operator_test.patch
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Python-modules-team mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team

