[gimp] plug-ins: fix crash of qbist when loading files.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: fix crash of qbist when loading files.
- Date: Tue, 23 Mar 2021 18:36:50 +0000 (UTC)
commit 7fb696206e72b8ea61f74e56f36adbfc6b9b0f17
Author: Jehan <jehan girinstud io>
Date: Tue Mar 23 19:29:02 2021 +0100
plug-ins: fix crash of qbist when loading files.
Contents of these arrays are assumed to be limited to a specific range.
While it did work sometimes (because a further processing would randomly
regenerate some of the indexes and correctly limit the range), it often
crashed.
This commit fixes the crash, but I am not sure this plug-in is working
exactly as expected regarding data load/save. It feels like you would
expect to always get the same patterns with a same source data. Yet
there is further randomization going on.
Oppositely when saving data, and re-loading it later, I would expect
once again to get back the exact same patterns I had when saving the
data. So it would be a way to save the result of randomization (as
chances to get back a pattern one liked are slim by definition when it's
created randomly).
Right now, it doesn't behave at all like this. Files are only used as
some kind of random seed, not as a way to save/load patterns. I feel
this was not the purpose of the file handling here.
plug-ins/common/qbist.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/qbist.c b/plug-ins/common/qbist.c
index c1bcdf2122..193165c2cb 100644
--- a/plug-ins/common/qbist.c
+++ b/plug-ins/common/qbist.c
@@ -676,16 +676,16 @@ load_data (gchar *name)
for (i = 0; i < MAX_TRANSFORMS; i++)
info[0].transformSequence[i] =
- get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 0);
+ get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 0) % NUM_TRANSFORMS;
for (i = 0; i < MAX_TRANSFORMS; i++)
- info[0].source[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 1);
+ info[0].source[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 1) % NUM_REGISTERS;
for (i = 0; i < MAX_TRANSFORMS; i++)
- info[0].control[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 2);
+ info[0].control[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 2) % NUM_REGISTERS;
for (i = 0; i < MAX_TRANSFORMS; i++)
- info[0].dest[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 3);
+ info[0].dest[i] = get_be16 (buf + i * 2 + MAX_TRANSFORMS * 2 * 3) % NUM_REGISTERS;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]