The vulnerability advisory GHSA-pmpg-6pww-fg6q explicitly mentions that the out-of-bounds access occurs in the ConnectedComponentsImage() function when processing connected-components:* artifacts. By analyzing the commits between the last vulnerable version (7.1.2-18) and the first patched version (7.1.2-19), I identified the fixing commit 2ab24d74865ab92faeeefe0fec890abf1e88e57c. The patch in this commit is located in the file MagickCore/vision.c and applies changes directly to the ConnectedComponentsImage function. Specifically, the patch adds if conditions to validate the index used to access the object array. This index is derived from the user-controlled connected-components:* artifacts. The absence of these checks in the vulnerable version allowed for an out-of-bounds write, which is the root cause of the vulnerability.