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
diff --git a/jdmarker.c b/jdmarker.c
index 7332940..5837edb 100644
--- a/jdmarker.c
+++ b/jdmarker.c
@@ -1310,6 +1310,11 @@
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.