MEDIUM severity: The `getMedianPrice` function in the `SimplePriceFeedStrategy.sol` contract is vulnerable to incorre. The `getMedianPrice` function in the `SimplePriceFeedStrategy.sol` contract is vulnerable to incorrect median price calculation when the length of `nonZeroPrices` is 2 and they are deviated. This occurs when the function returns the first non-zero value instead of the median value, which is incorrec...

Vulnerable code:
```\nfunction getMedianPriceIfDeviation(\n    uint256[] memory prices_,\n    bytes memory params_\n) public pure returns (uint256) {\n    if (prices_.length < 3) revert SimpleStrategy_PriceCountInvalid(prices_.length, 3);\n\n    uint256[] memory nonZeroPrices = _getNonZeroArray(prices_);\n\n    if (nonZeroPrices.length == 0) return 0;\n\n    uint256 firstNonZeroPrice = nonZeroPrices[0];\n\n    if (nonZeroPrices.length < 3) return firstNonZeroPrice;\n\n    uint256[] memory sortedPrices = _sort(nonZeroPrices);\n\n    uint256 averagePrice = _getAveragePrice(sortedPrices);\n    uint256 medianPrice = _getMedianPrice(sortedPrices);\n\n    if (params_.length!= DEVIATION_PARAMS_LENGTH) revert SimpleStrategy_ParamsInvalid(params_);\n    uint256 deviationBps = abi.decode(params_, (uint256));\n    if (deviationBps <= DEVIATION_MIN || deviationBps >= DEVIATION_MAX)\n        revert SimpleStrategy_ParamsInvalid(params_);\n\n    uint256 minPrice = sortedPrices[0];\n    if (((averagePrice - minPrice) * 10000) / averagePrice > deviationBps) return medianPrice;\n\n    uint256 maxPrice = sortedPrices[sortedPrices.length - 1];\n    if (((maxPrice - averagePrice) * 10000) / averagePrice > deviationBps) return medianPrice;\n\n    return firstNonZeroPrice;\n}\n\nfunction _sort(uint256[] memory array) internal pure returns (uint256[] memory) {\n    for (uint256 i = 0; i < array.length; i++) {\n        for (uint256 j = i + 1; j < array.length; i++) {\n            if (array[i] > array[j]) {\n                uint256 temp = array[i];\n                array[i] = array[j];\n                array[j] = temp;\n            }\n        }\n    }\n    return array;\n}\n```\n```\nfunction _getMedianPrice(uint256[] memory prices_) internal pure returns (uint256) {\n    uint256 pricesLen = prices_.length;\n\n    if (pricesLen % 2 == 0) {\n        uint256 middlePrice1 = prices_[pricesLen / 2 - 1];\n        uint256 middlePrice2 = prices_[pricesLen / 2];\n        return (middlePrice1 + middlePrice2) / 2;\n    }\n\n    return prices_[pricesLen / 2];\n}\n```\n```\nfunction getMedianPrice(uint256[] memory prices_, bytes memory) public pure returns (uint256) {\n    if (prices_.length < 3) revert SimpleStrategy_PriceCountInvalid(prices_.length, 3);\n\n    uint256[] memory nonZeroPrices = _getNonZeroArray(prices_);\n    uint256 nonZeroPricesLen = nonZeroPrices.length;\n\n    if (nonZeroPricesLen == 0) return 0;\n    if (nonZeroPricesLen < 3) return nonZeroPrices[0];\n\n    uint256[] memory sortedPrices = _sortArray(nonZeroPrices);\n\n    return _getMedianPrice(sortedPrices);\n}\n\nfunction _sortArray(uint256[] memory array) internal pure returns (uint256[] memory) {\n    uint256[] memory sortedArray = new uint256[](array.length);\n    for (uint256 i = 0; i < array.length; i++) {\n        sortedArray[i] = array[array.length - i - 1];\n    }\n    return sortedArray;\n}\n\nfunction _getMedianPrice(uint256[] memory prices) internal pure returns (uint256) {\n    uint256 len = prices.length;\n    if (len % 2 == 1) {\n        return prices[len / 2];\n    } else {\n        return (prices[len / 2 - 1] + prices[len / 2]) / 2;\n    }\n}\n```