Using the following give command, item stacks can be given extremely high counts up to the java max integer.
/give @s barrel[container=[{slot:0,item:{id:wooden_sword,count:2147483647}}]]
Placing and then breaking the barrel will cause the stack to split into smaller stacks, spawn at least a few hundred million item entities, and crash the world. The split stacks seem to have random counts around 10 to 30, so it's slightly less than 2 billion entities spawned at once.
Using commands to get an item with max_stack_size above 99 will detect and remove the invalid component, and setting the item count to below 1 will set it back to 1. Expected behavior would be for item count to be limited to the max_stack_size (or at least a hard coded max of 99).
Can confirm, An error was produced in the log after force quitting the game:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Download-2"