the proper way to do it is to put a length prefix right at the start of the encrypted block, and if you use a counter mode, you can just decrypt that first part and find out how much you need to decrypt, and then you do it
any other garbage should just be ignored, just like with nostr envelopes, once you have decoded the expected fields who gives a fuck if it's got 5gb of rubbish after it