#1140643 wand: Reads fail if file offsets are desynced

Package:
src:wand
Source:
src:wand
Submitter:
Max Gilmour
Date:
2026-06-25 20:37:02 UTC
Severity:
normal
Tags:
#1140643#5
Date:
2026-06-23 20:42:01 UTC
From:
To:
Dear Maintainer,

I discovered an upstream bug[1] which is causing migration issues on
Ubuntu[2].

Essentially, if the OS and Python file cursors ever get desynced, then
wand will pass the incorrect offset to ImageMagick. This was caused by
the move from RawIOBase to IOBase in the fix for upstream issue 675[3].

This problem can be reproduced on Debian by running a Python script
which first performs a buffered read and then seeks back to the
beginning:

```
from wand.image import Image

GIF = (b'GIF89a\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00!\xf9'

b'\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
open("test.gif", "wb").write(GIF)

f = open("test.gif", "rb")
f.read(16)
f.seek(0)
Image(file=f)
```

Running this script on Debian will produce the error:

```
$ python3 test.py
Traceback (most recent call last):
  File "/root/wand/test.py", line 10, in <module>
    Image(file=f)
    ~~~~~^^^^^^^^
  File "/usr/lib/python3/dist-packages/wand/image.py", line 9632, in
__init__
    self.read(file=file)
    ~~~~~~~~~^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/wand/image.py", line 10488, in read
    self.raise_exception()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/wand/resource.py", line 211, in
raise_exception
    raise e
wand.exceptions.MissingDelegateError: no decode delegate for this image
format `/tmp/magick-dnTm7mNPKK3qbsxOo1cdKU1ziBT5zdc8' @
error/constitute.c/ReadImage/755
```

I have added a patch which fixes this issue. I have also forwarded the
fix upstream[4], so this delta will eventually be dropped.

[1]: https://github.com/emcconville/wand/issues/688
[2]: https://bugs.launchpad.net/ubuntu/+source/wand/+bug/2158013
[3]: https://github.com/emcconville/wand/issues/675
[4]: https://github.com/emcconville/wand/pull/689

#1140643#10
Date:
2026-06-25 20:35:57 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
wand, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1140643@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Håvard F. Aasen <havard.f.aasen@pfft.no> (supplier of updated wand package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 25 Jun 2026 21:11:40 +0200
Source: wand
Architecture: source
Version: 0.7.2-1
Distribution: unstable
Urgency: medium
Maintainer: Håvard F. Aasen <havard.f.aasen@pfft.no>
Changed-By: Håvard F. Aasen <havard.f.aasen@pfft.no>
Closes: 1140643
Changes:
 wand (0.7.2-1) unstable; urgency=medium
 .
   * New upstream release, Closes: #1140643.
Checksums-Sha1:
 9c0861bfa525d366324d2805b6b9927514ff8fdb 1455 wand_0.7.2-1.dsc
 277346141af1f3df508128a1c5c5ec3319cc9449 11878736 wand_0.7.2.orig.tar.gz
 c9dfa13f0dcc5646e224c943982febf1b305b49f 8692 wand_0.7.2-1.debian.tar.xz
 9e9577576d2dada51bc2d93a362df72ddb2513a2 8656 wand_0.7.2-1_amd64.buildinfo
Checksums-Sha256:
 986e17a148366f4b18239a9e16c542dc25d2586421a8f9c15d5189603210d48b 1455 wand_0.7.2-1.dsc
 ad434962526c123eab92a46c8fc891de5b750504f8685a875e69afc95996da24 11878736 wand_0.7.2.orig.tar.gz
 d979971e532a9c991ff1be61f4fadc2ee5f1fa414d70917215bbfa5e22156b52 8692 wand_0.7.2-1.debian.tar.xz
 be5b3ab4438c81b8c9717dc4d5f171cba0298969aaf0dbc8529a90135e64b87c 8656 wand_0.7.2-1_amd64.buildinfo
Files:
 807ed4d556ce108b6a4df4fe3effaaea 1455 python optional wand_0.7.2-1.dsc
 59c2b937f1f5ec0456fcd2eee0ef00e7 11878736 python optional wand_0.7.2.orig.tar.gz
 829652994c7ae1bb8f18c6d5223a34b5 8692 python optional wand_0.7.2-1.debian.tar.xz
 6988da5f0d13ced63fa1b61ab0981d30 8656 python optional wand_0.7.2-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iI0EARYKADUWIQSD/42dLkLq3fzhpN2I4w6v/UfCtwUCaj2KxxccaGF2YXJkLmYu
YWFzZW5AcGZmdC5ubwAKCRCI4w6v/UfCt9h2AP4wGy2M5FJtKMLqRZ3K0R/PRX7I
eQ+0FCgM/fP1Bkk2rwD9H/mfiFZXvokGpE/HyuZ2cbTRKIkveaNZwZ3jHQCBpQ0=
=KMbF
-----END PGP SIGNATURE-----