Fix seg fault handling template parameter expressions containing '>='

Similar to previous commit

Issue #1037
This commit is contained in:
William S Fulton 2022-11-22 21:40:38 +00:00
commit ca5c68e544
3 changed files with 14 additions and 14 deletions

View file

@ -1043,16 +1043,17 @@ String *SwigType_templateprefix(const SwigType *t) {
* ----------------------------------------------------------------------------- */
String *SwigType_templatesuffix(const SwigType *t) {
const char *c;
const char *c, *d;
c = Char(t);
while (*c) {
d = c + strlen(c);
while (d > c) {
if ((*c == '<') && (*(c + 1) == '(')) {
int nest = 1;
c++;
while (*c && nest) {
if (*c == '<')
while ((d > c) && nest) {
if (*c == '<' && *(c + 1) == '(')
nest++;
if (*c == '>')
if (*c == '>' && *(c - 1) == ')')
nest--;
c++;
}
@ -1120,18 +1121,19 @@ String *SwigType_istemplate_only_templateprefix(const SwigType *t) {
* ----------------------------------------------------------------------------- */
String *SwigType_templateargs(const SwigType *t) {
const char *c;
const char *c, *d;
const char *start;
c = Char(t);
while (*c) {
d = c + strlen(c);
while (d > c) {
if ((*c == '<') && (*(c + 1) == '(')) {
int nest = 1;
start = c;
c++;
while (*c && nest) {
if (*c == '<')
while ((d > c) && nest) {
if (*c == '<' && *(c + 1) == '(')
nest++;
if (*c == '>')
if (*c == '>' && *(c - 1) == ')')
nest--;
c++;
}