]> git.sesse.net Git - vlc/blob - contrib/src/zvbi/zvbi-ssize_max.patch
Contribs: apply the zvbi fix on all platforms
[vlc] / contrib / src / zvbi / zvbi-ssize_max.patch
1 Linear memory extents over SSIZE_MAX are undefined, so there is no
2 point in protecting against them.
3 diff -ru zvbi.orig/src/export.c zvbi/src/export.c
4 --- zvbi.orig/src/export.c      2011-11-06 11:22:47.000000000 +0200
5 +++ zvbi/src/export.c   2011-11-06 11:27:39.000000000 +0200
6 @@ -1076,8 +1076,6 @@
7                 size_t count;
8  
9                 count = src_size;
10 -               if (unlikely (src_size > SSIZE_MAX))
11 -                       count = SSIZE_MAX & -4096;
12  
13                 for (retry = 10;; --retry) {
14                         actual = write (e->_handle.fd, src, count);
15 @@ -1632,12 +1630,7 @@
16                         free (e->buffer.data);
17                 }
18  
19 -               if (unlikely (e->buffer.offset > (size_t) SSIZE_MAX)) {
20 -                       errno = EOVERFLOW;
21 -                       actual = -1; /* failed */
22 -               } else {
23 -                       actual = e->buffer.offset;
24 -               }
25 +               actual = e->buffer.offset;
26         } else {
27                 if (VBI_EXPORT_TARGET_ALLOC == e->target)
28                         free (e->buffer.data);