Merge pull request #105 from davidgiven/dtrg-ass

Prevent ass crashing on error on 64-bit machines.
This commit is contained in:
David Given 2018-06-22 22:42:11 +02:00 committed by GitHub
commit 4cf3188fd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 9 deletions

View file

@ -256,3 +256,6 @@ struct proctab {
cons_t pr_off; /* distance from pb */
cons_t pr_loc; /* number of bytes locals */
};
extern void error(const char* string1, ...);
extern void werror(const char* string1, ...);

View file

@ -7,6 +7,7 @@
#include "ass00.h"
#include "assex.h"
#include <em_path.h>
#include <stdarg.h>
#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
@ -29,7 +30,7 @@ zero(area,length) char *area; unsigned length ; {
}
/* VARARGS1 */
static void pr_error(string1,a1,a2,a3,a4) char *string1 ; {
static void pr_error(const char* string1, va_list ap) {
/*
* diagnostic output
*/
@ -44,20 +45,28 @@ static void pr_error(string1,a1,a2,a3,a4) char *string1 ; {
fprintf(stderr,"proc %s, ",pstate.s_curpro->p_name);
}
fprintf(stderr,"line %d: ",line_num);
fprintf(stderr,string1,a1,a2,a3,a4);
vfprintf(stderr,string1,ap);
fprintf(stderr,"\n");
}
/* VARARGS1 */
void error(string1,a1,a2,a3,a4) char *string1 ; {
pr_error(string1,a1,a2,a3,a4) ;
void error(const char* string1, ...)
{
va_list ap;
va_start(ap, string1);
pr_error(string1, ap);
va_end(ap);
nerrors++ ;
}
/* VARARGS1 */
void werror(string1,a1,a2,a3,a4) char *string1 ; {
void werror(const char* string1, ...) {
va_list ap;
if ( wflag ) return ;
pr_error(string1,a1,a2,a3,a4) ;
va_start(ap, string1);
pr_error(string1, ap);
va_end(ap);
}
fatal(s) char *s; {