summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-09-13 08:31:55 +0200
committerantirez <antirez@gmail.com>2018-09-13 08:31:55 +0200
commitffbf8f4b8e87f1974a1488d5269659eccbb162e6 (patch)
treeee7592464f4dff07e4f387aee26c4e9dc86d30cf
parent5c9a7b891fc823fa1b5df09ec53b31db11e96145 (diff)
downloadredis-ffbf8f4b8e87f1974a1488d5269659eccbb162e6.tar.gz
LOLWUT: Limit maximum CPU effort.
-rw-r--r--src/lolwut.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lolwut.c b/src/lolwut.c
index 33824729b..63258095d 100644
--- a/src/lolwut.c
+++ b/src/lolwut.c
@@ -261,9 +261,14 @@ void lolwutCommand(client *c) {
getLongFromObjectOrReply(c,c->argv[3],&squares_per_col,NULL) != C_OK)
return;
+ /* Limits. We want LOLWUT to be always reasonably fast and cheap to execute
+ * so we have maximum number of columns, rows, and output resulution. */
if (cols < 1) cols = 1;
+ if (cols > 1000) cols = 1000;
if (squares_per_row < 1) squares_per_row = 1;
+ if (squares_per_row > 200) squares_per_row = 200;
if (squares_per_col < 1) squares_per_col = 1;
+ if (squares_per_col > 200) squares_per_col = 200;
/* Generate some computer art and reply. */
lwCanvas *canvas = lwDrawSchotter(cols,squares_per_row,squares_per_col);