Re: RFR: 8302671: libawt has a memmove decay error

2024-06-20 Thread Julian Waters
On Fri, 17 Feb 2023 14:35:45 GMT, Laurent Bourgès wrote: > Or use #define KBD_BUF_LEN 256 And use it explicitely in array init & > memmove... as plain old C. Turns out C++ has an even more elegant solution for this: Passing an array by reference https://github.com/openjdk/jdk/pull/19798/files

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-17 Thread Laurent Bourgès
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Or use #define KBD_BUF_LEN 256 And use it explicitely in array init &

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-17 Thread Julian Waters
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Looking back at this now, I wonder if we should also have changed the

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Kevin Rushforth
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Marked as reviewed by kcr (Author). - PR:

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Phil Race
On Thu, 16 Feb 2023 16:42:05 GMT, Kevin Rushforth wrote: > I just checked, and he is correct. In a function declaration, the array is > treated as a pointer, I see .. - PR: https://git.openjdk.org/jdk/pull/12597

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Phil Race
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Marked as reviewed by prr (Reviewer). - PR:

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Julian Waters
On Thu, 16 Feb 2023 18:12:33 GMT, Sergey Bylokhov wrote: >> In libawt, the size parameter is issued by a sizeof on an array, which as >> expected decays into a pointer and breaks the cleanup code by giving the >> incorrect size > > Interesting that this code can be compiled by gcc on windows.

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Sergey Bylokhov
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Marked as reviewed by serb (Reviewer). Interesting that this code can

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Julian Waters
On Thu, 16 Feb 2023 17:56:54 GMT, Sergey Bylokhov wrote: > Does anybody know how this was found, by some tool or compiler warning? It was found by gcc, which will raise a noisy alert of `-Wsizeof-array-argument` and `-Wsizeof-pointer-memaccess` when compiling awt_Component.cpp:3402:38:

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Sergey Bylokhov
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Does anybody know how this was found, by some tool or compiler

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Laurent Bourgès
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size LGTM. Length is 256*sizeof(BYTE) = 256. - PR:

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Kevin Rushforth
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size I just checked, and he is correct. In a function declaration, the

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Phil Race
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size Umm .. I'm not sure this is correct. Have you verified ?

Re: RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Magnus Ihse Bursie
On Thu, 16 Feb 2023 15:33:51 GMT, Julian Waters wrote: > In libawt, the size parameter is issued by a sizeof on an array, which as > expected decays into a pointer and breaks the cleanup code by giving the > incorrect size This looks bad. :-( Have you checked if this results in any

RFR: 8302671: libawt has a memmove decay error

2023-02-16 Thread Julian Waters
In libawt, the size parameter is issued by a sizeof on an array, which as expected decays into a pointer and breaks the cleanup code by giving the incorrect size - Commit messages: - Brackets - memmove decay error Changes: https://git.openjdk.org/jdk/pull/12597/files Webrev: