From 3e300dd1c3de9fe8105afe53e84da5443d664527 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 30 May 2014 22:44:55 +0200 Subject: [PATCH] Change the GDS parser behavior to prevent dreal to coredump. * Change: In , gds_parse & gds_error, if a layer whose index was not in the rds file was encountered, it was just discarted but the parsing did continue, resulting in a possibly incoherent RDS figure. Now we just stop the parsing and trigger the error mechanism returning a NULL pointer, which is then safely handled by . Under dreal, the error messages could be retrieved from the transient log files /tmp/alliance_all_PID, which is removed when dreal close. --- alliance/src/rds/src/gds_error.c | 3 +++ alliance/src/rds/src/gds_error.h | 13 +++++-------- alliance/src/rds/src/gds_parse.c | 9 ++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/alliance/src/rds/src/gds_error.c b/alliance/src/rds/src/gds_error.c index 312aa041..8c786830 100644 --- a/alliance/src/rds/src/gds_error.c +++ b/alliance/src/rds/src/gds_error.c @@ -106,6 +106,9 @@ char *message; (void)fprintf(stderr, "Il faudrait peut-etre la finir...\n"); pv_error.v_textp = (char *)NULL; break; + case ELAYERUNDEF : + (void)fprintf(stderr, "%s : There is no layer with such index in the technology (maybe wrong .rds file)\n", message); + break; case ENOTHER : break; default : diff --git a/alliance/src/rds/src/gds_error.h b/alliance/src/rds/src/gds_error.h index bed3e79b..1a4bfe5b 100644 --- a/alliance/src/rds/src/gds_error.h +++ b/alliance/src/rds/src/gds_error.h @@ -46,14 +46,11 @@ /* erreurs specifiques aux parser/driver */ -#define ENOCODE 101 /* Le code rencontre n'est pas reconnu. - */ -#define ENORELE 102 /* Le code existe bien mais correspond a une version trop recente du format d -e stockage */ - /* (GDS2, CIF...), dans la version avec laquelle on travaille, ce code etait -envisage */ - /* mais pas encore implemente. - */ +#define ENOCODE 101 /* Le code rencontre n'est pas reconnu. */ +#define ENORELE 102 /* Le code existe bien mais correspond a une version trop recente du format d e stockage */ + /* (GDS2, CIF...), dans la version avec laquelle on travaille, ce code etait envisage */ + /* mais pas encore implemente. */ +#define ELAYERUNDEF 103 /* There is no layer of this index in the technology. */ #define ENOTHER 255 /* Any other (wierd !) error. */ /********* diff --git a/alliance/src/rds/src/gds_parse.c b/alliance/src/rds/src/gds_parse.c index 10d05c61..dfa2239b 100644 --- a/alliance/src/rds/src/gds_parse.c +++ b/alliance/src/rds/src/gds_parse.c @@ -713,7 +713,14 @@ FILE *fp; if (islittle()) gds_layer = swaps(gds_layer); rds_layer = pv_gdslayer_to_symb(gds_layer); - if (rds_layer == (char)-1) FLAG = -1; + /*if (rds_layer == (char)-1) FLAG = -1;*/ + if (rds_layer == (char)-1) { + pv_init_error(); + pv_error.v_error = ELAYERUNDEF; + pv_error.v_textp = "(layer number)"; + pv_give_error("construit_rectangle"); + error = TRUE; + } if (pv_gdslayer_iscon(gds_layer)) rds_type = MBK_CONNECTOR_MASK; break;