Mailinglist Archive: opensuse (1785 mails)
| < Previous | Next > |
Re: [opensuse] Motif application crashes with 12.1 (glibc problem?)
- From: Rich Coe <rcoe@xxxxxxxxx>
- Date: Sun, 27 Nov 2011 09:40:31 -0600
- Message-id: <20111127094031.35bad0a9.rcoe@wi.rr.com>
On Sat, 26 Nov 2011 15:04:43 -0600
Rich Coe <rcoe@xxxxxxxxx> wrote:
I was wrong. Here's a test case showing that it's working.
It looks like one of the registered printf extension handlers in your
problem is being called because there's a specifier for %s (not sure)?
The info handler is specifying that there is 2 or more args expected and
the info handler is calling through to a null pointer.
Which is really weird, because the info handler has already been called once
in order to get to this point.
I'll have to think if there's a way to avoid or debug and fix this problem.
One possibility is to override the register_printf_function so that it
doesn't cause an issue in the calling program.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <printf.h>
# include <sys/param.h>
# define MAX_DIR_PATH_LEN MAXPATHLEN
int
jconv(FILE *stream, const struct printf_info *info, const void *const *args)
{
int ival1, ival2;
char *buf;
int len;
ival1 = *((int *) (args[0]));
ival2 = *((int *) (args[1]));
len = asprintf(&buf, "<j format> %d:%d", ival1, ival2);
if (-1 == len)
return -1;
len = fprintf(stream, "%s", buf);
free(buf);
return len;
}
int
jinfo(const struct printf_info *info, size_t n, int *argtypes)
{
if (n > 0) {
argtypes[0] = PA_INT;
argtypes[1] = PA_INT;
}
return 2;
}
void
main(int argc, char **argv)
{
char stackString[MAX_DIR_PATH_LEN];
char *path = stackString;
char * homedir;
register_printf_function('P', jconv, jinfo);
homedir = (char *) getenv ("HOME");
sprintf(path, "%%P %s %P", homedir, 1, 2);
printf("path set %s\n", path);
}
--
Rich Coe rcoe@xxxxxxxxx
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx
Rich Coe <rcoe@xxxxxxxxx> wrote:
On Sat, 26 Nov 2011 18:55:43 +0100
Christoph Bartoschek <bartoschek@xxxxxxxxxxxxxx> wrote:
I think I see the issue. The format string passed in has %% specifier, which
is supposed to print a literal % instead of being a format specifier.
In this case, the code does not recognize the '%%' construct, and fails.
I think it should be easy to construct a test case that shows this.
I was wrong. Here's a test case showing that it's working.
It looks like one of the registered printf extension handlers in your
problem is being called because there's a specifier for %s (not sure)?
The info handler is specifying that there is 2 or more args expected and
the info handler is calling through to a null pointer.
Which is really weird, because the info handler has already been called once
in order to get to this point.
I'll have to think if there's a way to avoid or debug and fix this problem.
One possibility is to override the register_printf_function so that it
doesn't cause an issue in the calling program.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <printf.h>
# include <sys/param.h>
# define MAX_DIR_PATH_LEN MAXPATHLEN
int
jconv(FILE *stream, const struct printf_info *info, const void *const *args)
{
int ival1, ival2;
char *buf;
int len;
ival1 = *((int *) (args[0]));
ival2 = *((int *) (args[1]));
len = asprintf(&buf, "<j format> %d:%d", ival1, ival2);
if (-1 == len)
return -1;
len = fprintf(stream, "%s", buf);
free(buf);
return len;
}
int
jinfo(const struct printf_info *info, size_t n, int *argtypes)
{
if (n > 0) {
argtypes[0] = PA_INT;
argtypes[1] = PA_INT;
}
return 2;
}
void
main(int argc, char **argv)
{
char stackString[MAX_DIR_PATH_LEN];
char *path = stackString;
char * homedir;
register_printf_function('P', jconv, jinfo);
homedir = (char *) getenv ("HOME");
sprintf(path, "%%P %s %P", homedir, 1, 2);
printf("path set %s\n", path);
}
--
Rich Coe rcoe@xxxxxxxxx
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx
| < Previous | Next > |