Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEGV on 16-bit-sized arg insertion #4602

Closed
p6rt opened this issue Sep 28, 2015 · 6 comments
Closed

SEGV on 16-bit-sized arg insertion #4602

p6rt opened this issue Sep 28, 2015 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 28, 2015

Migrated from rt.perl.org#126212 (status was 'resolved')

Searchable as RT126212$

@p6rt
Copy link
Author

p6rt commented Sep 28, 2015

From @TimToady

09​:24 < TimToady> m​: say 1, |(2 xx 65534)
09​:24 <+camelia> rakudo-moar cd8ce4​: OUTPUT«(signal SEGV)»

@p6rt
Copy link
Author

p6rt commented Sep 29, 2015

From @MARTIMM

On 09/28/2015 06​:52 PM, Larry Wall (via RT) wrote​:

# New Ticket Created by Larry Wall
# Please include the string​: [perl #​126212]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126212 >

09​:24 < TimToady> m​: say 1, |(2 xx 65534)
09​:24 <+camelia> rakudo-moar cd8ce4​: OUTPUT«(signal SEGV)»
It works fine until 49151 which is 0xbfff
Fails after 49152 (0xc000)

@p6rt
Copy link
Author

p6rt commented Sep 29, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 14, 2015

From @FROGGS

The might be either this​:

Inline Patch
diff --git a/src/core/args.c b/src/core/args.c
index c4f2696..4772034 100644
--- a/src/core/args.c
+++ b/src/core/args.c
@@ -677,7 +677,7 @@ MVMObject * MVM_args_slurpy_named(MVMThreadContext *tc, MVMArgProcContext *ctx)
 
 static void flatten_args(MVMThreadContext *tc, MVMArgProcContext *ctx) {
     MVMArgInfo arg_info;
-    MVMuint16 flag_pos = 0, arg_pos = 0, new_arg_pos = 0,
+    MVMuint32 flag_pos = 0, arg_pos = 0, new_arg_pos = 0,
         new_arg_flags_size = ctx->arg_count > 0x7FFF ? ctx->arg_count : ctx->arg_count * 2,
         new_args_size = new_arg_flags_size, i, new_flag_pos = 0, new_num_pos = 0;
     MVMCallsiteEntry *new_arg_flags;


Or this:
Inline Patch
diff --git a/src/core/args.c b/src/core/args.c
index c4f2696..43a966a 100644
--- a/src/core/args.c
+++ b/src/core/args.c
@@ -702,7 +702,7 @@ static void flatten_args(MVMThreadContext *tc, MVMArgProcContext *ctx) {
             MVMint64        count = REPR(list)->elems(tc, STABLE(list), list, OBJECT_BODY(list));
             MVMStorageSpec  lss   = REPR(list)->pos_funcs.get_elem_storage_spec(tc, STABLE(list));
 
-            if ((MVMint64)new_arg_pos + count > 0xFFFF) {
+            if ((MVMint64)new_arg_pos + count > 0xC000) {
                 MVM_exception_throw_adhoc(tc, "Too many arguments in flattening array.");
             }
 

@p6rt
Copy link
Author

p6rt commented Dec 14, 2015

From @jnthn

On Tue Sep 29 01​:40​:18 2015, mt1957@​gmail.com wrote​:

On 09/28/2015 06​:52 PM, Larry Wall (via RT) wrote​:

# New Ticket Created by Larry Wall
# Please include the string​: [perl #​126212]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126212 >

09​:24 < TimToady> m​: say 1, |(2 xx 65534)
09​:24 <+camelia> rakudo-moar cd8ce4​: OUTPUT«(signal SEGV)»
It works fine until 49151 which is 0xbfff
Fails after 49152 (0xc000)

Seems I unknowingly fixed this while fixing named arg flattening issues some weeks back. I've added tests to cover it in S06-signature/slurpy-and-interpolation.t to make sure we don't regress on it.

@p6rt p6rt closed this as completed Dec 14, 2015
@p6rt
Copy link
Author

p6rt commented Dec 14, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant