[DHG_packages] 01/01: http2: upstream patch to stop using memcpy. closes: #818143.

Clint Adams clint at moszumanska.debian.org
Wed Mar 16 04:21:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

clint pushed a commit to branch master
in repository DHG_packages.

commit e06c481625ab9d2db1990e09f02b56663b90cafa
Author: Clint Adams <clint at debian.org>
Date:   Wed Mar 16 00:17:03 2016 -0400

    http2: upstream patch to stop using memcpy.  closes: #818143.
---
 p/haskell-http2/debian/changelog                 |  6 +++
 p/haskell-http2/debian/patches/series            |  1 +
 p/haskell-http2/debian/patches/stop-using-memcpy | 55 ++++++++++++++++++++++++
 3 files changed, 62 insertions(+)

diff --git a/p/haskell-http2/debian/changelog b/p/haskell-http2/debian/changelog
index 2f15f3d..af36137 100644
--- a/p/haskell-http2/debian/changelog
+++ b/p/haskell-http2/debian/changelog
@@ -1,3 +1,9 @@
+haskell-http2 (1.5.3-2) unstable; urgency=medium
+
+  * Upstream patch to stop using memcpy.  closes: #818143.
+
+ -- Clint Adams <clint at debian.org>  Wed, 16 Mar 2016 00:13:10 -0400
+
 haskell-http2 (1.5.3-1) unstable; urgency=medium
 
   * New upstream release
diff --git a/p/haskell-http2/debian/patches/series b/p/haskell-http2/debian/patches/series
index 0e8d62d..55aa939 100644
--- a/p/haskell-http2/debian/patches/series
+++ b/p/haskell-http2/debian/patches/series
@@ -1,2 +1,3 @@
 no-bytestring-builder
 disable-tests-with-external-test-cases
+stop-using-memcpy
diff --git a/p/haskell-http2/debian/patches/stop-using-memcpy b/p/haskell-http2/debian/patches/stop-using-memcpy
new file mode 100644
index 0000000..c12dd16
--- /dev/null
+++ b/p/haskell-http2/debian/patches/stop-using-memcpy
@@ -0,0 +1,55 @@
+From e697e4ba7a957e9dea59cace57a97e3ad3bc7045 Mon Sep 17 00:00:00 2001
+From: Kazu Yamamoto <kazu at iij.ad.jp>
+Date: Wed, 16 Mar 2016 12:47:21 +0900
+Subject: [PATCH] stop using memcopy to copy an area to overlapped place. (#8)
+
+---
+ Network/HPACK/Buffer.hs | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/Network/HPACK/Buffer.hs b/Network/HPACK/Buffer.hs
+index c918094..d377dc4 100644
+--- a/Network/HPACK/Buffer.hs
++++ b/Network/HPACK/Buffer.hs
+@@ -71,16 +71,34 @@ writeWord8 WorkingBuffer{..} w = do
+ 
+ {-# INLINE shiftLastN #-}
+ shiftLastN :: WorkingBuffer -> Int -> Int -> IO ()
++shiftLastN WorkingBuffer{..} 0 _   = return ()
+ shiftLastN WorkingBuffer{..} i len = do
+     ptr <- readIORef offset
+-    let !src = ptr `plusPtr` negate len
+-        !dst = src `plusPtr` i
+-        !ptr' = ptr `plusPtr` i
++    let !ptr' = ptr `plusPtr` i
+     if ptr' >= limit then
+         throwIO BufferOverrun
++      else if i < 0 then do
++        let !src = ptr `plusPtr` negate len
++            !dst = src `plusPtr` i
++        shiftLeft dst src len
++        writeIORef offset ptr'
+       else do
+-        memcpy dst src len
++        let !src = ptr `plusPtr` (-1)
++            !dst = ptr' `plusPtr` (-1)
++        shiftRight dst src len
+         writeIORef offset ptr'
++  where
++    -- memcpy cannot be used for overlapped areas.
++    shiftLeft :: Buffer -> Buffer -> Int -> IO ()
++    shiftLeft _    _    0   = return ()
++    shiftLeft !dst !src n = do
++        peek src >>= poke dst
++        shiftLeft (dst `plusPtr` 1) (src `plusPtr` 1) (n - 1)
++    shiftRight :: Buffer -> Buffer -> Int -> IO ()
++    shiftRight _    _    0   = return ()
++    shiftRight !dst !src n = do
++        peek src >>= poke dst
++        shiftRight (dst `plusPtr` (-1)) (src `plusPtr` (-1)) (n - 1)
+ 
+ {-# INLINE copyByteString #-}
+ copyByteString :: WorkingBuffer -> ByteString -> IO ()
+-- 
+2.7.0
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git



More information about the Pkg-haskell-commits mailing list