Skip to content

Negative RotationSize silently produces huge ulong, disabling log rotation #280

Description

@Christophe-Rogiers

Description

In src/Servy.Core/Domain/Service.cs (line 464):

RotationSizeInBytes = (ulong)RotationSize * 1024UL * 1024UL,

RotationSize is an int. There is no validation that it is positive before the cast to ulong. A negative value (e.g., from an unchecked database row or deserialization) would wrap to a very large ulong, effectively disabling log rotation.

Severity

Warning — silent data corruption.

Suggested fix

Add validation that RotationSize > 0 before conversion, or clamp to a minimum of 1.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions