Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison macro.c @ 203:3a25180d3a5c
Abort on line numbering or column numbering overflow.
Line numbers are limited to values that fit in "unsigned int". Also
reject input lines longer than 2^32-1 characters. It seems reasonable
to presume that any input that violates these constraints is someone
screwing around and not a serious attempt to compile or preprocess
anything useful. Done in response to n2129, but without getting into
any of the silliness found there.
author | David A. Holland |
---|---|
date | Tue, 01 Aug 2017 14:51:04 -0400 |
parents | 1d2bad7151f9 |
children |
comparison
equal
deleted
inserted
replaced
202:e200cb46ab23 | 203:3a25180d3a5c |
---|---|
521 char *param; | 521 char *param; |
522 | 522 |
523 while (params != NULL) { | 523 while (params != NULL) { |
524 len = strspn(params, ws); | 524 len = strspn(params, ws); |
525 params += len; | 525 params += len; |
526 p->column += len; | 526 place_addcolumns(p, len); |
527 s = strchr(params, ','); | 527 s = strchr(params, ','); |
528 if (s) { | 528 if (s) { |
529 len = s-params; | 529 len = s-params; |
530 param = dostrndup(params, len); | 530 param = dostrndup(params, len); |
531 s++; | 531 s++; |
539 complain_fail(); | 539 complain_fail(); |
540 } else { | 540 } else { |
541 stringarray_add(&m->params, param, NULL); | 541 stringarray_add(&m->params, param, NULL); |
542 } | 542 } |
543 params = s; | 543 params = s; |
544 p->column += len; | 544 place_addcolumns(p, len); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
548 static | 548 static |
549 bool | 549 bool |