[PATCH] ipa: rpi: Prevent segfault if AGC algorithm is absent
Naushir Patuck
naush at raspberrypi.com
Thu May 29 13:14:54 CEST 2025
Hi Benjamin,
Thank you for this fix!
On Fri, 23 May 2025 at 10:57, Benjamin Mugnier <benjamin.mugnier at foss.st.com>
wrote:
> Even without AGC definition in the tuning file, the application would
> still dereference agc unconditionally, leading to a segmentation fault
> if AGC is absent.
> This is relevant for sensors already providing AGC/AEC by themselves.
> Check if AGC is present prior to setting maximum exposure time.
>
> Signed-off-by: Benjamin Mugnier <benjamin.mugnier at foss.st.com>
>
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
> ---
> src/ipa/rpi/common/ipa_base.cpp | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/rpi/common/ipa_base.cpp
> b/src/ipa/rpi/common/ipa_base.cpp
> index
> e0a93daa9db229bb2829803fffc6b2f6c8f11061..e0f8b7e782f4340a069a2d7b9cf9dee3141c72df
> 100644
> --- a/src/ipa/rpi/common/ipa_base.cpp
> +++ b/src/ipa/rpi/common/ipa_base.cpp
> @@ -1563,7 +1563,8 @@ void IpaBase::applyFrameDurations(Duration
> minFrameDuration, Duration maxFrameDu
>
> RPiController::AgcAlgorithm *agc =
> dynamic_cast<RPiController::AgcAlgorithm *>(
> controller_.getAlgorithm("agc"));
> - agc->setMaxExposureTime(maxExposureTime);
> + if (agc)
> + agc->setMaxExposureTime(maxExposureTime);
> }
>
> void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList
> &ctrls)
>
> ---
> base-commit: ad5326c926831fe7a943d10fd800de43e596f171
> change-id: 20250523-fix_segfault_agc-5f2735edec5f
>
> Best regards,
> --
> Benjamin Mugnier <benjamin.mugnier at foss.st.com>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20250529/1c289acc/attachment.htm>
More information about the libcamera-devel
mailing list