~ubuntu-branches/ubuntu/quantal/valgrind/quantal

« back to all changes in this revision

Viewing changes to debian/patches/fix-VEX-PCMPxSTRx.patch

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2012-10-05 20:16:28 UTC
  • Revision ID: package-import@ubuntu.com-20121005201628-iyyitwvtlb3xq380
Tags: 1:3.7.0-0ubuntu4
* fix-buffer-overflows.patch: fix overflows in vgdb
* 05_fix-callgrind_control.patch: fix valgrind process name (LP: #1036283)
* fix-VEX-PCMPxSTRx.patch: fix strstr handling (LP: #1027977)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: upstream patch, modified to fit version 3.7.0
 
2
 Emulation of PCMPxSTRx mode 0x0C was wrong
 
3
 for searching an empty needle in an empty haystack.
 
4
Applied-Upstream: 3.8.0
 
5
Origin: r2447
 
6
Author: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
 
7
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/1027977
 
8
Bug: https://bugs.kde.org/show_bug.cgi?id=303963
 
9
 
 
10
diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c
 
11
index a10f869..ae627f6 100644
 
12
--- a/VEX/priv/guest_generic_x87.c
 
13
+++ b/VEX/priv/guest_generic_x87.c
 
14
@@ -815,9 +815,6 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
 
15
       UInt   validL  = ~(zmaskL | -zmaskL);  // not(left(zmaskL))
 
16
       UInt   validR  = ~(zmaskR | -zmaskR);  // not(left(zmaskR))
 
17
       for (hi = 0; hi < 16; hi++) {
 
18
-         if ((validL & (1 << hi)) == 0)
 
19
-            // run off the end of the haystack
 
20
-            break;
 
21
          UInt m = 1;
 
22
          for (ni = 0; ni < 16; ni++) {
 
23
             if ((validR & (1 << ni)) == 0) break;
 
24
@@ -826,6 +826,9 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
 
25
             if (argL[i] != argR[ni]) { m = 0; break; }
 
26
          }
 
27
          boolRes |= (m << hi);
 
28
+         if ((validL & (1 << hi)) == 0)
 
29
+            // run off the end of the haystack
 
30
+            break;
 
31
       }
 
32
 
 
33
       // boolRes is "pre-invalidated"