[theora-dev] uninitialised theora_info values

Conrad Parker conrad at metadecks.org
Mon Jan 7 18:57:39 PST 2008


Ralph recently checked in a version of theora/tests/noop.c that uses
the new API. Part of the reason for this test is to check for memory
leaks in the library's constructors and destructors. You can run the
test suite under valgrind by configuring with
--enable-valgrind-testing. The test passes, but gives output like:

make[1]: Entering directory `/home/conrad/src/xiph.org/theora/tests'
----  + Initializing theora_info struct ...
----  + Allocating encoder context ...
==15878== Conditional jump or move depends on uninitialised value(s)
==15878==    at 0x4032485: theora_encode_init (in
==15878== Conditional jump or move depends on uninitialised value(s)
==15878==    at 0x40324C0: theora_encode_init (in
----  + Clearing theora_info struct ...
----  + Freeing encoder context ...
PASS: noop

Tracing this through, the theora_info structure seen by
theora_encode_init is created by th_info2theora_info in
encapiwrapper.c. This in turn does not set the following members of
the theora_info struct it creates:

  /* decode */

  /* encode */

The values of some of these are subsequently used by
theora_encode_init, hence the errors from valgrind. It seems these
have no equivalent in the new API, so perhaps they should be given
reasonable default values. As is it seems the behaviour of the wrapper
is non-deterministic.

I don't know what these default values should be; perhaps someone with
more clue can fill them in.

(My uninformed guess is "the value of 'keyframe_frequency_force' for
all the keyframe_* fields, and 0 for the rest". Do I win?)



More information about the theora-dev mailing list