Week 2 + Week 3: Dangling pointer bugs, silly mistakes and a lot of CMake
22 June, 2026Hey wassup guys! Welcome to yet another blog made by me!
I've been busy for a while due to exam stress and my passport situation.
But I am glad to share that I finally got the passport yesterday! This brings me one step closer to making it to Akademy 2026 in Graz, Austria.
Now I just need to get my flight and hotel bookings done, get some required documents signed from my university, get a VISA or a forex card and then finally apply for the Austrian Schengen VISA.
Anyways, this blog is supposed to be about sharing learnings / progress made in week 2 and 3 of my GSoC journey so let's go!
If I recall correctly, I did the following in the past 2 weeks:
Work on some CI issues in the android image and the windows MinGW image.
- I had to build harfbuzz from scratch for the android image because it simply didn't have it by default.
- For the windows image, I actually found a bug in harfbuzz which made the windows build fail. I filed an issue and they fixed it very quickly by using AI https://github.com/harfbuzz/harfbuzz/issues/6026. I don't really like it myself that harfbuzz is heavily using AI in its development but I think I can't really do much about it. Perhaps this is a topic worth covering in another blog?
Destroying resources after we have no use for them.
- I was leaking some memory by using harfbuzz to generate subset fonts but was never really calling the destroy functions required to free that memory.
Fix a dangling pointer bug that caused invalid fonts on subsetting.
- I unknowingly made a serious dangling pointer or use after free bug when I was working on destroying harfbuzz resources after I had used them. The gist here was that I used a class called
MemStreambut didn't realize that it actually had a read-only view on my subset font data, let's sayconst char* fontData. I called harfbuzz destroy function after constructing this stream and it freed thefontDataand then when the time came for writing to the file, thefontDatapointer inside the stream was dangling and corrupted data got written.
Making font subsetting an optional feature
- I reported the harfbuzz issue and the patch MR got merged so does that mean the windows CI would also get fixed immediately? Not quite, the harfbuzz people would first need to release a release and then it needs to be updated in the package repository to finally get the patch working. We aren't sure about just how much time this is going to take so I worked on making the font subsetting functionality optional by using CMake options magic.
What I learned
- I am now less likely to make dangling pointer mistakes but it could still happen.
- Quite a lot of CMake and how to do optional features with it.
- Dealing with CI.
- And a couple more things I forgot about but I did actually learn from them.
Conclusion
I think I did like below-okayish amount of work done but I am glad I actually learnt a lot of useful and important things.
I would like to thank my mentor Albert Astals Cid, and the Poppler community for helping me.
I would also like to thank KDE board members for approving my reimbursement requests.
And finally, thank you for reading my blog so far :)
Until next time!