diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2017-03-27 22:37:21 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2017-03-27 22:37:21 -0700 |
commit | 221587a31b4ffe42a6f4d0b0f817e2a2cedcfb45 (patch) | |
tree | bfbe4abcba1abaf1609a19d9c73fc42dd466a00b | |
parent | 54faa24df5f5c6c260d4d55075736b04d494cdc6 (diff) |
charts: reduce CHART_MAX_ARGC from 512 to 64
`make tags` in the linux kernel revealed that XDrawText can return
a BadLength error, which is not mentioned in the man page.
Glancing at the xorg-server source for doPolyText() this is found:
1192 else { /* print a string */
1193
1194 unsigned char *pNextElt;
1195
1196 pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
1197 if (pNextElt > c->endReq) {
1198 err = BadLength;
1199 goto bail;
1200 }
So there appears to bea fairly arbitrary ceiling on how many items one can
pass to XDrawText, and it probably depends on the cumulative length of the
individual items overflowing the maximum request length.
Well.. that's lame, and shrinking the maximum items makes it less likely to
trip over this in practice, but it probably just takes a long enough
individual item to trigger it again.
I had erred on the side of "excessively long" assuming XDrawText would just
deal and clip the text to the bounds of the destination drawable, just in
case there was an argv with lots of tiny items, then that would be covered.
This approach is incompatible with the potential for BadLength errors, so
drastically shrinking the maximum number of items until further notice.
-rw-r--r-- | src/charts.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/charts.c b/src/charts.c index 4deb846..46e10da 100644 --- a/src/charts.c +++ b/src/charts.c @@ -41,7 +41,7 @@ #define CHART_GRAPH_MIN_HEIGHT (4 * CHART_ROW_HEIGHT) #define CHART_ISTHREAD_ARGV "~" /* use this string to mark threads in the argv field */ #define CHART_NOCOMM_ARGV "#missed it!" /* use this string to substitute the command when missing in argv field */ -#define CHART_MAX_ARGC 512 /* this is a huge amount */ +#define CHART_MAX_ARGC 64 /* this is a huge amount */ #define CHART_VMON_PROC_WANTS (VMON_WANT_PROC_STAT | VMON_WANT_PROC_FOLLOW_CHILDREN | VMON_WANT_PROC_FOLLOW_THREADS) #define CHART_VMON_SYS_WANTS (VMON_WANT_SYS_STAT) |