Repository navigation
serve dlna: fix crash on Browse with a negative StartingIndex or RequestedCount - #10221
Merged
Merged
Conversation
…estedCount A Browse request with a negative StartingIndex or RequestedCount made the handler panic slicing the directory listing, so the client got a plain text 500 with the Go runtime error instead of a SOAP fault. These arguments are ui4 in the ContentDirectory SCPD, so reject negative values with the UPnP "Argument Value Invalid" (600) error.
agammann
approved these changes
Nov 1, 2026
agammann
left a comment
There was a problem hiding this comment.
The guard rejects negative Browse arguments before either value reaches the child-list slicing code. Both negative cases now produce the existing UPnP argument-value error, and the full DLNA package test suite passed on head ab55d06 with go test -count=1 ./cmd/serve/dlna.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change do?
ContentDirectory#Browsesliced the child list withStartingIndexandRequestedCountstraight from the SOAP body. A negative value (both areui4in the SCPD, but nothing enforced that) panicked withslice bounds out of range. The logging middleware recovered it, so the client got a plain-text 500 with the Go runtime error instead of a UPnP fault.Browse now rejects negative values with UPnP error 600 (Argument Value Invalid), the code already used for an unknown
BrowseFlag.RequestedCount == 0still means "all".TestContentDirectoryBrowseNegativeIndexcovers (-1, 0) and (0, -1); both panic on master.Linked issue
None. Small bug fix found while reading the handler.
Checklist
test_allpasses for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.