Skip to content

Hercules crash at dyn_perform_random_number_operation #765

@salva-rczero

Description

@salva-rczero

For some execution of PRNO, function code 114 (PRNO-TRNG), Hercules crashed due to an invalid memory address.

After some testing, I traced it to these lines:

randbytes = regs->GR( r2 + 1 );
...
randbytes = regs->GR( r1 + 1 );
...
randbytes = regs->GR( r1 + 1 );
...
randbytes = regs->GR( r2 + 1 ); 

Here, randbytes was loading an unexpectedly large value.
I believe (and the POP confirms) that the length field must be a 32-bit number for AMODE 24/31.

So I changed them to:

 randbytes = GR_A(r1 + 1, regs); 
or
 randbytes = GR_A(r2 + 1, regs); 

And It works!

Please consider applying this change. I should provide a patch/pull request, but since it’s a small fix and I don’t quite remember how to, I’m just reporting it here.

Thanks, salva.

Metadata

Metadata

Assignees

Labels

BUGThe issue describes likely incorrect product functionality that likely needs corrected.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions