From d4fad7f50f79626455d88523207e05b868819cd8 Mon Sep 17 00:00:00 2001 From: Wei-Ta Chen Date: Fri, 29 Apr 2011 18:11:33 -0700 Subject: [PATCH] Fix 4287289, where undefined behavior triggered in jpeg tile based decoding. The issue is that we set a flag to the current SOS marker position, but we don't initialize the flag before testing the flag. Change-Id: I4e0cc243a36c348584e888d95fcba2af896f6bc2 --- jdmarker.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdmarker.c b/jdmarker.c index 7332940..5837edb 100644 --- a/jdmarker.c +++ b/jdmarker.c @@ -1310,6 +1310,11 @@ jinit_marker_reader (j_decompress_ptr cinfo) marker->pub.read_markers = read_markers; marker->pub.read_restart_marker = read_restart_marker; marker->pub.get_sos_marker_position = get_sos_marker_position; + + // Initialize the SOS marker position to avoid underdefined behavior due to + // using a undefined field. + marker->pub.current_sos_marker_position = 0; + /* Initialize COM/APPn processing. * By default, we examine and then discard APP0 and APP14, * but simply discard COM and all other APPn.