Fix stack overflow caused by cyclic references


The existing check for cycles happens too late. The endless
recursion already happens earlier in QSvgHandler::parse()

OSS-Fuzz found this as issue 42532991.

Credit to OSS-Fuzz

Pick-to: 6.9 6.8
Change-Id: Iae087aff7d2858d5fe954f8ff5db63811a0bc26b
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
commit0332df304f013ded362537c1f61556098b875352
parentebf0441aef468a700433548b73110ea657a5cb03
authorRobert Löhning <robert.loehning@qt.io>
committerRobert Löhning <robert.loehning@qt.io>
commit timeFri, 17 Jan 2025 13:19:41 +0000