Depends where the vulnerability lies. Plenty of iMessage DoS attacks [1-4] have targeted CoreText, which, I believe is written in C and CoreFoundation. I think all of these DoS attacks could be mitigated by not viewing the message and disabling message previews in notifications.
[1] https://habr.com/ru/post/191654/
[2] https://appleinsider.com/articles/15/05/27/bug-in-ios-notifi...
[3] https://blog.zecops.com/research/analyzing-the-ios-telugu-cr...
[4] https://www.macrumors.com/2018/05/09/how-to-fix-black-dot-im...