From c55e673cd2dde342f734f5472b95dd19c9d7f0af Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 23 Oct 2024 04:49:09 +0200 Subject: [PATCH] [backend/federation] Don't allow negative voter counts --- Iceshrimp.Backend/Core/Services/NoteService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Iceshrimp.Backend/Core/Services/NoteService.cs b/Iceshrimp.Backend/Core/Services/NoteService.cs index 57bfa133..e43b0acf 100644 --- a/Iceshrimp.Backend/Core/Services/NoteService.cs +++ b/Iceshrimp.Backend/Core/Services/NoteService.cs @@ -1009,6 +1009,8 @@ public class NoteService( if (choices.Count == 0) throw GracefulException.UnprocessableEntity("Poll must have at least one option"); + if (question.VotersCount is < 0) + throw GracefulException.UnprocessableEntity("Voters count must not be negative"); poll = new Poll {