Fossil SCM
Fix a bug in HTML attribute parsing.
Commit
cb44f7dea478e9b08127a27dc37b7697bce22748
Parent
dc82d5709c83308…
1 file changed
+25
-20
+25
-20
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -39,29 +39,30 @@ | ||
| 39 | 39 | #define ATTR_ALT 2 |
| 40 | 40 | #define ATTR_BGCOLOR 3 |
| 41 | 41 | #define ATTR_BORDER 4 |
| 42 | 42 | #define ATTR_CELLPADDING 5 |
| 43 | 43 | #define ATTR_CELLSPACING 6 |
| 44 | -#define ATTR_CLEAR 7 | |
| 45 | -#define ATTR_COLOR 8 | |
| 46 | -#define ATTR_COLSPAN 9 | |
| 47 | -#define ATTR_COMPACT 10 | |
| 48 | -#define ATTR_FACE 11 | |
| 49 | -#define ATTR_HEIGHT 12 | |
| 50 | -#define ATTR_HREF 13 | |
| 51 | -#define ATTR_HSPACE 14 | |
| 52 | -#define ATTR_ID 15 | |
| 53 | -#define ATTR_NAME 16 | |
| 54 | -#define ATTR_ROWSPAN 17 | |
| 55 | -#define ATTR_SIZE 18 | |
| 56 | -#define ATTR_SRC 19 | |
| 57 | -#define ATTR_START 20 | |
| 58 | -#define ATTR_TYPE 21 | |
| 59 | -#define ATTR_VALIGN 22 | |
| 60 | -#define ATTR_VALUE 23 | |
| 61 | -#define ATTR_VSPACE 24 | |
| 62 | -#define ATTR_WIDTH 25 | |
| 44 | +#define ATTR_CLASS 7 | |
| 45 | +#define ATTR_CLEAR 8 | |
| 46 | +#define ATTR_COLOR 9 | |
| 47 | +#define ATTR_COLSPAN 10 | |
| 48 | +#define ATTR_COMPACT 11 | |
| 49 | +#define ATTR_FACE 12 | |
| 50 | +#define ATTR_HEIGHT 13 | |
| 51 | +#define ATTR_HREF 14 | |
| 52 | +#define ATTR_HSPACE 15 | |
| 53 | +#define ATTR_ID 16 | |
| 54 | +#define ATTR_NAME 17 | |
| 55 | +#define ATTR_ROWSPAN 18 | |
| 56 | +#define ATTR_SIZE 19 | |
| 57 | +#define ATTR_SRC 20 | |
| 58 | +#define ATTR_START 21 | |
| 59 | +#define ATTR_TYPE 22 | |
| 60 | +#define ATTR_VALIGN 23 | |
| 61 | +#define ATTR_VALUE 24 | |
| 62 | +#define ATTR_VSPACE 25 | |
| 63 | +#define ATTR_WIDTH 26 | |
| 63 | 64 | #define AMSK_ALIGN 0x0000001 |
| 64 | 65 | #define AMSK_ALT 0x0000002 |
| 65 | 66 | #define AMSK_BGCOLOR 0x0000004 |
| 66 | 67 | #define AMSK_BORDER 0x0000008 |
| 67 | 68 | #define AMSK_CELLPADDING 0x0000010 |
| @@ -752,11 +753,11 @@ | ||
| 752 | 753 | if( p->aAttr[i].zValue ){ |
| 753 | 754 | const char *zVal = p->aAttr[i].zValue; |
| 754 | 755 | if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){ |
| 755 | 756 | blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal); |
| 756 | 757 | }else{ |
| 757 | - blob_appendf(pOut, "=\"%s\"", p->aAttr[i].zValue); | |
| 758 | + blob_appendf(pOut, "=\"%s\"", zVal); | |
| 758 | 759 | } |
| 759 | 760 | } |
| 760 | 761 | } |
| 761 | 762 | blob_append(pOut, ">", 1); |
| 762 | 763 | } |
| @@ -1086,10 +1087,14 @@ | ||
| 1086 | 1087 | ParsedMarkup markup; |
| 1087 | 1088 | int n; |
| 1088 | 1089 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1089 | 1090 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1090 | 1091 | |
| 1092 | + /* Make sure the attribute constants and names still align | |
| 1093 | + ** following changes in the attribute list. */ | |
| 1094 | + assert( strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 ); | |
| 1095 | + | |
| 1091 | 1096 | while( z[0] ){ |
| 1092 | 1097 | if( wikiUseHtml ){ |
| 1093 | 1098 | n = nextRawToken(z, p, &tokenType); |
| 1094 | 1099 | }else{ |
| 1095 | 1100 | n = nextWikiToken(z, p, &tokenType); |
| 1096 | 1101 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -39,29 +39,30 @@ | |
| 39 | #define ATTR_ALT 2 |
| 40 | #define ATTR_BGCOLOR 3 |
| 41 | #define ATTR_BORDER 4 |
| 42 | #define ATTR_CELLPADDING 5 |
| 43 | #define ATTR_CELLSPACING 6 |
| 44 | #define ATTR_CLEAR 7 |
| 45 | #define ATTR_COLOR 8 |
| 46 | #define ATTR_COLSPAN 9 |
| 47 | #define ATTR_COMPACT 10 |
| 48 | #define ATTR_FACE 11 |
| 49 | #define ATTR_HEIGHT 12 |
| 50 | #define ATTR_HREF 13 |
| 51 | #define ATTR_HSPACE 14 |
| 52 | #define ATTR_ID 15 |
| 53 | #define ATTR_NAME 16 |
| 54 | #define ATTR_ROWSPAN 17 |
| 55 | #define ATTR_SIZE 18 |
| 56 | #define ATTR_SRC 19 |
| 57 | #define ATTR_START 20 |
| 58 | #define ATTR_TYPE 21 |
| 59 | #define ATTR_VALIGN 22 |
| 60 | #define ATTR_VALUE 23 |
| 61 | #define ATTR_VSPACE 24 |
| 62 | #define ATTR_WIDTH 25 |
| 63 | #define AMSK_ALIGN 0x0000001 |
| 64 | #define AMSK_ALT 0x0000002 |
| 65 | #define AMSK_BGCOLOR 0x0000004 |
| 66 | #define AMSK_BORDER 0x0000008 |
| 67 | #define AMSK_CELLPADDING 0x0000010 |
| @@ -752,11 +753,11 @@ | |
| 752 | if( p->aAttr[i].zValue ){ |
| 753 | const char *zVal = p->aAttr[i].zValue; |
| 754 | if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){ |
| 755 | blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal); |
| 756 | }else{ |
| 757 | blob_appendf(pOut, "=\"%s\"", p->aAttr[i].zValue); |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | blob_append(pOut, ">", 1); |
| 762 | } |
| @@ -1086,10 +1087,14 @@ | |
| 1086 | ParsedMarkup markup; |
| 1087 | int n; |
| 1088 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1089 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1090 | |
| 1091 | while( z[0] ){ |
| 1092 | if( wikiUseHtml ){ |
| 1093 | n = nextRawToken(z, p, &tokenType); |
| 1094 | }else{ |
| 1095 | n = nextWikiToken(z, p, &tokenType); |
| 1096 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -39,29 +39,30 @@ | |
| 39 | #define ATTR_ALT 2 |
| 40 | #define ATTR_BGCOLOR 3 |
| 41 | #define ATTR_BORDER 4 |
| 42 | #define ATTR_CELLPADDING 5 |
| 43 | #define ATTR_CELLSPACING 6 |
| 44 | #define ATTR_CLASS 7 |
| 45 | #define ATTR_CLEAR 8 |
| 46 | #define ATTR_COLOR 9 |
| 47 | #define ATTR_COLSPAN 10 |
| 48 | #define ATTR_COMPACT 11 |
| 49 | #define ATTR_FACE 12 |
| 50 | #define ATTR_HEIGHT 13 |
| 51 | #define ATTR_HREF 14 |
| 52 | #define ATTR_HSPACE 15 |
| 53 | #define ATTR_ID 16 |
| 54 | #define ATTR_NAME 17 |
| 55 | #define ATTR_ROWSPAN 18 |
| 56 | #define ATTR_SIZE 19 |
| 57 | #define ATTR_SRC 20 |
| 58 | #define ATTR_START 21 |
| 59 | #define ATTR_TYPE 22 |
| 60 | #define ATTR_VALIGN 23 |
| 61 | #define ATTR_VALUE 24 |
| 62 | #define ATTR_VSPACE 25 |
| 63 | #define ATTR_WIDTH 26 |
| 64 | #define AMSK_ALIGN 0x0000001 |
| 65 | #define AMSK_ALT 0x0000002 |
| 66 | #define AMSK_BGCOLOR 0x0000004 |
| 67 | #define AMSK_BORDER 0x0000008 |
| 68 | #define AMSK_CELLPADDING 0x0000010 |
| @@ -752,11 +753,11 @@ | |
| 753 | if( p->aAttr[i].zValue ){ |
| 754 | const char *zVal = p->aAttr[i].zValue; |
| 755 | if( p->aAttr[i].iACode==ATTR_SRC && zVal[0]=='/' ){ |
| 756 | blob_appendf(pOut, "=\"%s%s\"", g.zBaseURL, zVal); |
| 757 | }else{ |
| 758 | blob_appendf(pOut, "=\"%s\"", zVal); |
| 759 | } |
| 760 | } |
| 761 | } |
| 762 | blob_append(pOut, ">", 1); |
| 763 | } |
| @@ -1086,10 +1087,14 @@ | |
| 1087 | ParsedMarkup markup; |
| 1088 | int n; |
| 1089 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1090 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1091 | |
| 1092 | /* Make sure the attribute constants and names still align |
| 1093 | ** following changes in the attribute list. */ |
| 1094 | assert( strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 ); |
| 1095 | |
| 1096 | while( z[0] ){ |
| 1097 | if( wikiUseHtml ){ |
| 1098 | n = nextRawToken(z, p, &tokenType); |
| 1099 | }else{ |
| 1100 | n = nextWikiToken(z, p, &tokenType); |
| 1101 |