Segfault on call to TTF_OpenFontRW

I am trying to load a TTF file from a zip archive, using PhysFS and physfsrwops to open the zip and make a SDL_RWops structure.

SDL version is 2.0.5-4
SDL_ttf is 2.0.14-1
and PhysFS/physfsrwops is 2.0.3
(on 64 bit linux with g++)

Here is a short program that reproduces the problem. I have removed error checking to keep it brief (but the zip file is definitely in the build folder, and the file is in the zip).

#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <physfs.h>
#include "physfsrwops/physfsrwops.h"

int main(int argc, char* argv[]) {
  SDL_Init(SDL_INIT_EVERYTHING);
  TTF_Init();
  PHYSFS_init(argv[0]);
  PHYSFS_mount("menlo.zip", nullptr, 0);
  PHYSFS_exists("menlo.ttf");
  PHYSFS_File* fp = PHYSFS_openRead("menlo.ttf");
  SDL_RWops* rw = PHYSFSRWOPS_makeRWops(fp);
  TTF_Font* font = TTF_OpenFontIndexRW(rw, 1, 15, 0);
  return 0;
}

The code runs if I comment out the line TTF_Init();.

My debugger says the segfault is happening in TTF_OpenFontIndexRW at line 426 in a call to “main_arena” but I am not finding that function.

Thanks in advance for any help.

Dave

Can you report a bug at bugzilla.libsdl.org and include an attachment with the code and data for this example?

Thanks!

Ok. Submitted bug #3834.

thanks for the reply!