Giving a player a bundle containing either 0 or negative amounts of an item creates a bundle that appears empty, and functions normally, but the NBT still contains the illegal stack until emptied, as can be viewed with "/data get entity @s SelectedItem".
Can confirm, the game won't give the player the illegal items when the bundle is emptied though.