Post Reply 
[Free42] ASTO 00 bug
01-09-2020, 06:30 PM
Post: #3
RE: [Free42] ASTO 00 bug
Code:
thomas@thomas-VirtualBox:~/free42$ git diff
diff --git a/common/core_sto_rcl.cc b/common/core_sto_rcl.cc
index 3ac0144b..1679e923 100644
--- a/common/core_sto_rcl.cc
+++ b/common/core_sto_rcl.cc
@@ -390,11 +390,11 @@ int generic_sto(arg_struct *arg, char operation) {
                 if (num >= size)
                     return ERR_SIZE_ERROR;
                 if (reg_x->type == TYPE_STRING) {
+                    if (!disentangle((vartype *) rm))
+                        return ERR_INSUFFICIENT_MEMORY;
                     vartype_string *vs = (vartype_string *) reg_x;
                     phloat *ds = rm->array->data + num;
                     int len, i;
-                    if (!disentangle((vartype *) rm))
-                        return ERR_INSUFFICIENT_MEMORY;
                     len = vs->length;
                     phloat_length(*ds) = len;
                     for (i = 0; i < len; i++)
thomas@thomas-VirtualBox:~/free42$

In a nutshell: when ASTO is called to modify REGS, the REGS variable and the X register are pointing at a shared instance of the matrix. The two variables have to be "disentangled" (shared memory with copy-on-write semantics), and this is currently being done halfway through the operation, while it should be done at the start. The result is that the string data gets written to one copy of the matrix (the wrong one), while the "this is a string" bit gets written to the other. Oops.

Tonight I'll take a closer look at generic_sto() to see if anything else like that is hiding in there, and then I'll release 2.5.13.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[Free42] ASTO 00 bug - Werner - 01-09-2020, 03:46 PM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-09-2020, 04:38 PM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-09-2020 06:30 PM
RE: [Free42] ASTO 00 bug - Werner - 01-09-2020, 06:32 PM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-10-2020, 01:18 AM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-10-2020, 01:27 PM
RE: [Free42] ASTO 00 bug - ijabbott - 01-10-2020, 10:01 PM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-10-2020, 11:54 PM
RE: [Free42] ASTO 00 bug - Thomas Okken - 01-13-2020, 05:19 PM
RE: [Free42] ASTO 00 bug - zeno333 - 01-13-2020, 10:38 PM



User(s) browsing this thread: 1 Guest(s)