[libjasper1 1.900.1-3ubuntu0.8.04.1 (amd64 binary) in ubuntu hardy] tries to use /tmptmp.XXXXXXXXXX as a mkstemp() template
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
jasper (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
ohnobinki@
jas_stream_tmpfile
/tmp
%stmp.XXXXXXXXXX
!((tmp >> 3) & (~0x1f))
enc->tmpstream
cannot open tmp file
(tmpval & (1 << (wordsize - 1))) == 0
-- it seems that the first two entries of strings's output indicate that libjasper does something like:
``
char *template;
char *tmpdir = "/tmp";
asprintf(template, "%stmp.
mkstemp(template);
''
which results in an attempt to open a file in / instead of in /tmptmp. This means that any non-root application using an imagemagick suite tool to load a jpeg2k image will fail as jasper fails if it can't create this file:
npb5@julian:~$ mogrify -format png /tmp/*.jp2
error: cannot decode code stream
mogrify: unable to decode image file `/tmp/presbyter
strace outputs:
open("/
I was able to work arouind fix this by putting the following C code into an LD_PRELOADed shared object. However, it would be wonderful if libjasper in ubuntu hardy 8.04 LTS could be fixed and a new release made:
/**
* Rewrite a bad template of /tmptmp , a bug in libjasper on ubunto 8
* LTS, to /tmp/tmp. Truncate one of the Xes at the end of the
* template.
*/
int mkstemp(char *template)
{
int ret;
size_t counter;
static void *libc = NULL;
static int(*libc_
if (!libc)
{
libc = dlopen(
if(!libc)
abort();
libc_mkstemp = dlsym(libc, "mkstemp");
if(
abort();
}
if (!strncmp(template, "/tmptmp", strlen("/tmptmp")))
{
fprintf(
for (counter = strlen(template) - 1; counter > 4; counter --)
template[counter] = template[counter - 1];
template[4] = '/';
fprintf(
}
ret = (*libc_
return ret;
}
Changed in jasper (Ubuntu): | |
status: | New → Confirmed |
tags: | added: patch |
> which results in an attempt to open a file in / instead of in /tmptmp.
I meant to say ``instead of in /tmp''.