Note: I'm not sure whether it's just a problem of the small sort_buffer_size value, or something more generic. Simply scaling up the data and buffer makes the failure disappear, but it's not a guarantee, the test case seems to be very sensitive to specific data lengths.
Reproducible with at least MyISAM, InnoDB, Aria.
Not reproducible on 10.4 – it doesn't crash and returns what appears to be a correct result (see below).
Non-debug build of 10.5 doesn't crash, but it produces a different result comparing to 10.4. Below is a slightly different test case which shows it. The data and query structure are the same, only the select list contains items which are easier to read and compare.
Note different counts and GROUP_CONCAT results for f/1000 and y/746.
Plan is the same on both versions:
The failure appeared in 10.5 tree with this commit: