[vlc-devel] Reentrancy and non-const static variables

Justus Piater Justus-bulk at Piater.name
Sun Aug 3 10:42:28 CEST 2008


The VLC code has lots of reentrancy problems, at least one of which is
probably responsible for Firefox crashing if multiple VLC plugin
instances are present (Ticket #686). As a first shot, I've grepped for
non-const statics, fixed many of them by simply making them const (see
"f" in the list below, and the first patch) or marked them as
requiring attention ("?" in the list below). Some of them may be
relatively easy to fix by their maintainers (or even actually
irrelevant); many of them, however, appear to be serious.

I suggest that all developers peruse the list below, and that the
respective maintainers ponder how they might make their code reentrant
(see "?" in the list below).

This first patch should not result in any changes to the compiled
code, except for compiler optimizations.

A second patch simply turns a static buffer into an automatic
buffer. As far as I can see, there is no reason for this buffer to be
static.

Please comment and/or commit these two patches.

Thanks,
Justus


This list is not complete; in addition to static variables, there are
non-static global variables.

nc = not compiled in my configuration, *may* contain real problems?
f  = fixed
?  = likely problem

     nc	vlc/bindings/python/vlc_instance.c
     nc	vlc/bindings/python/vlc_internal.c
     nc	vlc/bindings/python/vlc_media.c
     nc	vlc/bindings/python/vlc_mediacontrol.c
     nc	vlc/bindings/python/vlc_module.c
     nc	vlc/bindings/python/vlc_position.c
     nc	vlc/bindings/python/vlc_mediaplayer.c
     nc	vlc/extras/package/macosx/eyetvplugin/eyetvplugin.c
     nc	vlc/include/vlc_pgpkey.h
 ?	vlc/include/vlc_threads.h
   f	vlc/include/vlc_bits.h
   f	vlc/include/vlc_codecs.h
   f	vlc/include/vlc_config_cat.h
   f	vlc/include/vlc_gcrypt.h
     nc	vlc/libs/loader/driver.c
     nc	vlc/libs/loader/ext.c
     nc	vlc/libs/loader/ldt_keeper.c 
     nc	vlc/libs/loader/module.c
     nc	vlc/libs/loader/pe_image.c
     nc	vlc/libs/loader/pe_resource.c
     nc	vlc/libs/loader/registry.c
     nc	vlc/libs/loader/win32.c
 ?	vlc/libs/srtp/srtp.c
     nc	vlc/lxdialog/checklist.c
     nc	vlc/lxdialog/lxdialog.c
     nc	vlc/lxdialog/menubox.c
     nc	vlc/lxdialog/textbox.c
     nc	vlc/modules/access/cdda/access.c
     nc	vlc/modules/access/cdda/info.c
     nc	vlc/modules/access/dshow/dshow.cpp
     nc	vlc/modules/access/v4l.c
   f	vlc/modules/access/v4l2/v4l2.c
 ?	vlc/modules/access/vcdx/access.c
   f nc	vlc/modules/access/vcdx/info.c
     nc	vlc/modules/access/qtcapture.m
   f	vlc/modules/audio_filter/resampler/bandlimited.h
 ?	vlc/modules/audio_filter/spatializer/spatializer.cpp
   f	vlc/modules/audio_filter/format.c
   f	vlc/modules/audio_output/file.c
 ?	vlc/modules/audio_output/portaudio.c#ifdef PORTAUDIO_IS_SERIOUSLY_BROKEN
 ?	vlc/modules/codec/cc.c
     nc	vlc/modules/codec/dmo/dmo.c
   f	vlc/modules/codec/flac.c
   f	vlc/modules/codec/quicktime.c
   f	vlc/modules/codec/realaudio.c
   f	vlc/modules/codec/speex.c
   f	vlc/modules/codec/telx.c
   f	vlc/modules/codec/vorbis.c
     nc	vlc/modules/codec/xvmc/motion_comp_mmx.c
     nc	vlc/modules/codec/xvmc/decode.c
     nc	vlc/modules/codec/xvmc/header.c
   f	vlc/modules/codec/avcodec/audio.c
 ?	vlc/modules/codec/avcodec/avcodec.c
   f	vlc/modules/codec/avcodec/fourcc.h
 ?	vlc/modules/codec/avcodec/video.c
   f	vlc/modules/codec/araw.c
   f	vlc/modules/control/http/macros.h
   f	vlc/modules/control/dbus.h
 ?	vlc/modules/control/ntservice.c
 ?	vlc/modules/demux/asademux.c
 ?	vlc/modules/demux/asademux_defs.h
   f	vlc/modules/demux/asf/libasf.c
   f	vlc/modules/demux/avi/libavi.c
   f	vlc/modules/demux/mkv.cpp
 ?	vlc/modules/demux/mp4/drms.c
   f	vlc/modules/demux/playlist/dvb.c
   f	vlc/modules/demux/rawvid.c
 ?	vlc/modules/demux/subtitle.c
     nc	vlc/modules/gui/beos/Bitmaps.h
     nc	vlc/modules/gui/beos/DrawingTidbits.cpp
     nc	vlc/modules/gui/beos/VideoWindow.h
     nc	vlc/modules/gui/beos/VideoOutput.cpp
     nc	vlc/modules/gui/macosx/AppleRemote.m
     nc	vlc/modules/gui/macosx/eyetv.m
     nc	vlc/modules/gui/macosx/prefs_widgets.h
     nc	vlc/modules/gui/macosx/about.m
     nc	vlc/modules/gui/macosx/bookmarks.m
     nc	vlc/modules/gui/macosx/extended.m
     nc	vlc/modules/gui/macosx/intf.m
     nc	vlc/modules/gui/macosx/misc.m
     nc	vlc/modules/gui/macosx/open.m
     nc	vlc/modules/gui/macosx/playlist.m
     nc	vlc/modules/gui/macosx/playlistinfo.m
     nc	vlc/modules/gui/macosx/prefs.m
     nc	vlc/modules/gui/macosx/simple_prefs.m
     nc	vlc/modules/gui/macosx/update.m
     nc	vlc/modules/gui/macosx/wizard.m
 ?	vlc/modules/gui/pda/pda_support.c
 ?	vlc/modules/gui/qt4/components/playlist/playlist_model.cpp
 ? f	vlc/modules/gui/qt4/components/playlist/playlist_model.hpp
 ?	vlc/modules/gui/qt4/components/interface_widgets.cpp
 ?	vlc/modules/gui/qt4/dialogs/bookmarks.hpp
 ?	vlc/modules/gui/qt4/dialogs/errors.hpp
 ?	vlc/modules/gui/qt4/dialogs/extended.hpp
 ?	vlc/modules/gui/qt4/dialogs/gototime.hpp
 ?	vlc/modules/gui/qt4/dialogs/mediainfo.hpp
 ?	vlc/modules/gui/qt4/dialogs/messages.hpp
 ?	vlc/modules/gui/qt4/dialogs/playlist.hpp
 ?	vlc/modules/gui/qt4/dialogs/podcast_configuration.hpp
 ?	vlc/modules/gui/qt4/dialogs/sout.hpp
 ?	vlc/modules/gui/qt4/dialogs/vlm.hpp
 ?	vlc/modules/gui/qt4/dialogs/preferences.hpp
 ? f	vlc/modules/gui/qt4/dialogs/help.hpp
 ?	vlc/modules/gui/qt4/dialogs/open.hpp
 ? 	vlc/modules/gui/qt4/dialogs_provider.hpp
 ?	vlc/modules/gui/qt4/input_manager.hpp
 ?	vlc/modules/gui/qt4/menus.hpp
   f	vlc/modules/gui/qt4/qt4.hpp
 ?	vlc/modules/gui/qt4/input_manager.cpp
 ?	vlc/modules/gui/qt4/menus.cpp
 ?	vlc/modules/gui/qt4/qt4.cpp
 ?	vlc/modules/gui/skins2/parser/skin_parser.cpp
 ?	vlc/modules/gui/skins2/parser/xmlparser.cpp
 ?	vlc/modules/gui/skins2/src/theme_loader.cpp
 ?	vlc/modules/gui/skins2/unzip/crypt.h
     nc	vlc/modules/gui/wince/preferences_widgets.h
     nc	vlc/modules/gui/wince/interface.cpp
     nc	vlc/modules/gui/wince/menus.cpp
     nc	vlc/modules/gui/wince/open.cpp
     nc	vlc/modules/gui/wince/playlist.cpp
     nc	vlc/modules/gui/wxwidgets/dialogs/infopanels.cpp
     nc	vlc/modules/gui/wxwidgets/dialogs/preferences_widgets.h
     nc	vlc/modules/gui/wxwidgets/extrapanel.cpp
     nc	vlc/modules/gui/wxwidgets/interface.cpp
     nc	vlc/modules/gui/wxwidgets/wxwidgets.cpp
   f	vlc/modules/misc/lua/demux.c
   f	vlc/modules/misc/lua/intf.c
 ?	vlc/modules/misc/lua/libs/variables.c
   f	vlc/modules/misc/lua/meta.c
 ?	vlc/modules/misc/memcpy/fastmemcpy.h #ifdef STATISTICS
   f	vlc/modules/misc/freetype.c
 ?	vlc/modules/misc/gtk_main.c
 ?	vlc/modules/misc/quartztext.c
 ?	vlc/modules/misc/qte_main.cpp
   f nc	vlc/modules/misc/win32text.c
   f	vlc/modules/mux/mp4.c
 ?	vlc/modules/services_discovery/upnp_intel.cpp
   f	vlc/modules/stream_out/transcode.c
vlc/modules/video_chroma/i420_rgb8.c
 ?	vlc/modules/video_filter/atmo/AtmoCalculations.cpp
 ?	vlc/modules/video_filter/atmo/AtmoOutputFilter.cpp
   f	vlc/modules/video_filter/atmo/atmo.cpp
   f	vlc/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
	warning in UnregisterCommand(); Reg...() should not strdup!
 ?	vlc/modules/video_filter/dynamicoverlay/dynamicoverlay_list.c
 ?	vlc/modules/video_filter/seamcarving.c
 ?   nc	vlc/modules/video_output/msw/direct3d.c
     nc	vlc/modules/video_output/msw/events.c
 ?	vlc/modules/video_output/x11/xcommon.c
   f	vlc/modules/video_output/x11/xvmc.c
 ?	vlc/modules/video_output/fb.c
   f	vlc/modules/video_output/sdl.c
 ?	vlc/modules/visualization/galaktos/main.c
 ?	vlc/modules/visualization/visual/fft.c
   f	vlc/modules/visualization/visual/visual.c
     nc	vlc/projects/activex/connectioncontainer.cpp
     nc	vlc/projects/activex/main.cpp
     nc	vlc/projects/activex/vlccontrol2.cpp
     nc	vlc/projects/macosx/framework/Sources/VLCEventManager.m
     nc	vlc/projects/macosx/framework/Sources/VLCMedia.m
     nc	vlc/projects/macosx/framework/Sources/VLCMediaDiscoverer.m
     nc	vlc/projects/macosx/framework/Sources/VLCMediaLibrary.m
     nc	vlc/projects/macosx/framework/Sources/VLCServicesDiscoverer.m
     nc	vlc/projects/macosx/framework/Sources/VLCTime.m
     nc	vlc/projects/macosx/framework/Sources/VLCLibrary.m
     nc	vlc/projects/macosx/framework/Sources/VLCMediaPlayer.m
     nc	vlc/projects/macosx/frontrow_plugin/VLCApplianceController.m
     nc	vlc/projects/macosx/frontrow_plugin/VLCDebug.m
     nc	vlc/projects/macosx/frontrow_plugin/VLCMediaLayer.m
     nc	vlc/projects/macosx/frontrow_plugin/VLCMediaListController.m
     nc	vlc/projects/macosx/vlc_app/Sources/AppleRemote.m
     nc	vlc/projects/macosx/vlc_app/Sources/VLCAppAdditions.m
     nc	vlc/projects/macosx/vlc_app/Sources/VLCAppBindings.m
     nc	vlc/projects/macosx/vlc_app/Sources/VLCMainWindowController.m
     nc	vlc/projects/macosx/vlc_app/Sources/VLCMediaLayer.m
 ?	vlc/projects/mozilla/control/nporuntime.h
 ?	vlc/projects/mozilla/support/npmac.cpp
 ?	vlc/projects/mozilla/support/npunix.c
 ?	vlc/projects/mozilla/support/npwin.cpp
 ?	vlc/projects/mozilla/vlcshell.cpp
 ?	vlc/src/config/dirs.c
   f nc	vlc/src/extras/getopt1.c
 ?	vlc/src/extras/dirent.c
 ?	vlc/src/extras/getopt.c
 ?	vlc/src/input/decoder.c
 ?	vlc/src/misc/beos_specific.cpp
 ?	vlc/src/misc/cpu.c
 ?	vlc/src/misc/devices.c
 ?	vlc/src/misc/linux_specific.c #if 0
 ? f	vlc/src/misc/mtime.c
 ?	vlc/src/misc/objects.c
 ?	vlc/src/misc/rand.c
 ?	vlc/src/misc/threads.c
   f	vlc/src/misc/image.c
 ?	vlc/src/misc/variables.c
 ?	vlc/src/modules/cache.c
 ?	vlc/src/network/getaddrinfo.c
   f	vlc/src/network/httpd.c
 ?	vlc/src/network/rootbind.c
 ?	vlc/src/playlist/sort.c
 ?	vlc/src/text/unicode.c
 ?	vlc/src/text/wincp.c
 ?	vlc/src/libvlc.c
 ?	vlc/test/libvlc/test.h
 ?	vlc/test/native/gc.c
 ?	vlc/test/native/init.c



More information about the vlc-devel mailing list