Bug 102896 - src/moxie/ffi.c:239:arrayIndexOutOfBounds
Summary: src/moxie/ffi.c:239:arrayIndexOutOfBounds
Status: RESOLVED MOVED
Alias: None
Product: gcc
Classification: Unclassified
Component: libffi (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: cppcheck
  Show dependency treegraph
 
Reported: 2021-10-22 11:06 UTC by David Binderman
Modified: 2021-10-23 05:19 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-10-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2021-10-22 11:06:48 UTC
Static analyser cppcheck says:

  trunk.git/libffi/src/moxie/ffi.c:239:46: error: Array 'register_args[6]' accessed at index 7, which is out of bounds. [arrayIndexOutOfBounds]

Source code is

  unsigned register_args[6] =
    { arg1, arg2, arg3, arg4, arg5, arg6 };

...

     else if (ptr == (char *) &register_args[7])
Comment 1 David Binderman 2021-10-22 11:10:12 UTC
git blame says:

92456a4e5658 (H.J. Lu           2021-08-31 07:14:47 -0700 239)       else if (ptr == (char *) &register_args[7])

Adding HJ for their opinion.
Comment 2 H.J. Lu 2021-10-22 11:48:34 UTC
Does it happen in libffi upstream?

https://github.com/libffi/libffi
Comment 3 David Binderman 2021-10-22 11:54:42 UTC
(In reply to H.J. Lu from comment #2)
> Does it happen in libffi upstream?
> 
> https://github.com/libffi/libffi

Yes.
Comment 4 Martin Liška 2021-10-22 11:55:38 UTC
Then, please file it here: https://github.com/libffi/libffi/issues.
Comment 5 David Binderman 2021-10-22 12:01:48 UTC
(In reply to Martin Liška from comment #4)
> Then, please file it here: https://github.com/libffi/libffi/issues.

Done.

https://github.com/libffi/libffi/issues/666
Comment 6 Martin Liška 2021-10-22 12:04:03 UTC
Moved.