<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/xorg-lib-libXpm.git/src, branch master</title>
<subtitle>gitlab.freedesktop.org: xorg/lib/libxpm.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/'/>
<entry>
<title>Set close-on-exec when opening files</title>
<updated>2023-04-22T17:15:24+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-03-28T01:35:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=4524c578581b427145ae136844fc655a89e94777'/>
<id>4524c578581b427145ae136844fc655a89e94777</id>
<content type='text'>
Relies on platforms with O_CLOEXEC support following POSIX requirement
to not copy the close-on-exec flag to the new fd in dup2(), but to leave
it unset instead, since that's how fd's are passed to child processes
to handled compressed files.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Relies on platforms with O_CLOEXEC support following POSIX requirement
to not copy the close-on-exec flag to the new fd in dup2(), but to leave
it unset instead, since that's how fd's are passed to child processes
to handled compressed files.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>xpmReadRgbNames: constify filename argument</title>
<updated>2023-03-28T01:21:12+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-03-28T01:21:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=8b9c4e4c5d278409dc41d19f0c8a8940403cd5c7'/>
<id>8b9c4e4c5d278409dc41d19f0c8a8940403cd5c7</id>
<content type='text'>
Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parse.c: remove unused function xstrlcpy()</title>
<updated>2023-02-12T21:22:57+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-02-12T21:22:57+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=92030dd4c221e8043521ae4dc9d32d50e6ff44c4'/>
<id>92030dd4c221e8043521ae4dc9d32d50e6ff44c4</id>
<content type='text'>
parse.c:74:1: warning: unused function 'xstrlcpy' [-Wunused-function]
xstrlcpy(char *dst, const char *src, size_t dstsize)
^

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
parse.c:74:1: warning: unused function 'xstrlcpy' [-Wunused-function]
xstrlcpy(char *dst, const char *src, size_t dstsize)
^

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>parse.c: Wrap FREE_CIDX definition in do { ... } while(0)</title>
<updated>2023-02-12T18:51:46+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-02-12T18:51:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=8e0e63519069bed43b3bf1ce1f11fd0cd516d3e4'/>
<id>8e0e63519069bed43b3bf1ce1f11fd0cd516d3e4</id>
<content type='text'>
Makes it match the definition in create.c and eliminates
clang warnings:

create.c:2409:13: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                        FREE_CIDX;
                                 ^
create.c:2440:17: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                            FREE_CIDX;
                                     ^
create.c:2444:13: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                        FREE_CIDX;
                                 ^
create.c:2449:15: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            FREE_CIDX;
                     ^

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Makes it match the definition in create.c and eliminates
clang warnings:

create.c:2409:13: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                        FREE_CIDX;
                                 ^
create.c:2440:17: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                            FREE_CIDX;
                                     ^
create.c:2444:13: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
                        FREE_CIDX;
                                 ^
create.c:2449:15: warning: empty expression statement has no effect;
 remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
            FREE_CIDX;
                     ^

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>XpmCreateDataFromXpmImage: Fix misleading indentation</title>
<updated>2023-02-12T17:25:10+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-02-12T17:23:09+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=25616112983cd3f8bfe5379771b5bfd63b3c3621'/>
<id>25616112983cd3f8bfe5379771b5bfd63b3c3621</id>
<content type='text'>
CrDatFrI.c: In function ‘XpmCreateDataFromXpmImage’:
CrDatFrI.c:245:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  245 |             if (header[l])
      |             ^~
In file included from CrDatFrI.c:40:
XpmI.h:80:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   80 | #define XpmFree(ptr) free(ptr)
      |                      ^~~~
CrDatFrI.c:247:17: note: in expansion of macro ‘XpmFree’
  247 |                 XpmFree(header);
      |                 ^~~~~~~
CrDatFrI.c: In function ‘CreateColors’:

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
CrDatFrI.c: In function ‘XpmCreateDataFromXpmImage’:
CrDatFrI.c:245:13: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  245 |             if (header[l])
      |             ^~
In file included from CrDatFrI.c:40:
XpmI.h:80:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   80 | #define XpmFree(ptr) free(ptr)
      |                      ^~~~
CrDatFrI.c:247:17: note: in expansion of macro ‘XpmFree’
  247 |                 XpmFree(header);
      |                 ^~~~~~~
CrDatFrI.c: In function ‘CreateColors’:

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>open-zfile: Make compress &amp; uncompress commands optional</title>
<updated>2023-02-05T20:14:43+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-02-05T20:14:43+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=c52082c6e4811958dd741d67e1178b4e36a09923'/>
<id>c52082c6e4811958dd741d67e1178b4e36a09923</id>
<content type='text'>
If compress is not found, we disable writing to .Z files,
but leave the rest of the compression code active.

If uncompress is not found, we use gzip to read .Z files.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If compress is not found, we disable writing to .Z files,
but leave the rest of the compression code active.

If uncompress is not found, we use gzip to read .Z files.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a memleak in ParsePixels error code path</title>
<updated>2023-01-23T23:46:34+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2023-01-23T09:57:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=77e3b389eb92b8d8f94f5b83c1d3d7cd4db5b037'/>
<id>77e3b389eb92b8d8f94f5b83c1d3d7cd4db5b037</id>
<content type='text'>
In this particular error path we have already allocated cidx[0..256]
with 256 instances of fresh and juicy memory. Freeing that is annoying,
but luckily there's a helpful FREE_CIDX macro that does exactly that.

Fixes f80fa6a:
  Fix CVE-2022-44617: Runaway loop with width of 0 and enormous height

Found by covscan

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In this particular error path we have already allocated cidx[0..256]
with 256 instances of fresh and juicy memory. Freeing that is annoying,
but luckily there's a helpful FREE_CIDX macro that does exactly that.

Fixes f80fa6a:
  Fix CVE-2022-44617: Runaway loop with width of 0 and enormous height

Found by covscan

Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use gzip -d instead of gunzip</title>
<updated>2023-01-16T18:30:39+00:00</updated>
<author>
<name>Peter Hutterer</name>
<email>peter.hutterer@who-t.net</email>
</author>
<published>2023-01-16T09:44:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=8178eb0834d82242e1edbc7d4fb0d1b397569c68'/>
<id>8178eb0834d82242e1edbc7d4fb0d1b397569c68</id>
<content type='text'>
GNU gunzip [1] is a shell script that exec's `gzip -d`. Even if we call
/usr/bin/gunzip with the correct built-in path, the actual gzip call
will use whichever gzip it finds first, making our patch pointless.

Fix this by explicitly calling gzip -d instead.

https://git.savannah.gnu.org/cgit/gzip.git/tree/gunzip.in

[Part of the fix for CVE-2022-4883]
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GNU gunzip [1] is a shell script that exec's `gzip -d`. Even if we call
/usr/bin/gunzip with the correct built-in path, the actual gzip call
will use whichever gzip it finds first, making our patch pointless.

Fix this by explicitly calling gzip -d instead.

https://git.savannah.gnu.org/cgit/gzip.git/tree/gunzip.in

[Part of the fix for CVE-2022-4883]
Signed-off-by: Peter Hutterer &lt;peter.hutterer@who-t.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent a double free in the error code path</title>
<updated>2023-01-12T23:47:43+00:00</updated>
<author>
<name>Matthieu Herrb</name>
<email>matthieu@herrb.eu</email>
</author>
<published>2023-01-12T05:05:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=c5ab17bcc34914c0b0707d2135dbebe9a367c5f0'/>
<id>c5ab17bcc34914c0b0707d2135dbebe9a367c5f0</id>
<content type='text'>
xpmParseDataAndCreate() calls XDestroyImage() in the error path.
Reproducible with sxpm "zero-width.xpm", that file is in the test/
directory.

The same approach is needed in the bytes_per_line == 0 condition though
here it just plugs a memory leak.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
xpmParseDataAndCreate() calls XDestroyImage() in the error path.
Reproducible with sxpm "zero-width.xpm", that file is in the test/
directory.

The same approach is needed in the bytes_per_line == 0 condition though
here it just plugs a memory leak.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix CVE-2022-4883: compression commands depend on $PATH</title>
<updated>2023-01-12T23:47:43+00:00</updated>
<author>
<name>Alan Coopersmith</name>
<email>alan.coopersmith@oracle.com</email>
</author>
<published>2023-01-06T20:50:48+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/xorg-lib-libXpm.git/commit/?id=515294bb8023a45ff916696d0a14308ff4f3a376'/>
<id>515294bb8023a45ff916696d0a14308ff4f3a376</id>
<content type='text'>
By default, on all platforms except MinGW, libXpm will detect if a
filename ends in .Z or .gz, and will when reading such a file fork off
an uncompress or gunzip command to read from via a pipe, and when
writing such a file will fork off a compress or gzip command to write
to via a pipe.

In libXpm 3.5.14 or older these are run via execlp(), relying on $PATH
to find the commands.  If libXpm is called from a program running with
raised privileges, such as via setuid, then a malicious user could set
$PATH to include programs of their choosing to be run with those
privileges.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By default, on all platforms except MinGW, libXpm will detect if a
filename ends in .Z or .gz, and will when reading such a file fork off
an uncompress or gunzip command to read from via a pipe, and when
writing such a file will fork off a compress or gzip command to write
to via a pipe.

In libXpm 3.5.14 or older these are run via execlp(), relying on $PATH
to find the commands.  If libXpm is called from a program running with
raised privileges, such as via setuid, then a malicious user could set
$PATH to include programs of their choosing to be run with those
privileges.

Signed-off-by: Alan Coopersmith &lt;alan.coopersmith@oracle.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
