[bittorrent] Metainfo Integers

Alan alan.mcgovern at gmail.com
Thu Jul 22 06:44:05 EDT 2010


No, you're not safe at all. Anyone can put a negative number in a .torrent
file and for any reason and you will encounter this in the wild. Why would
you even want to treat bencoded numbers as being unsigned when the spec
clearly says they are signed?

Alan

On Thu, Jul 22, 2010 at 9:59 AM, Roger Pau Monné <royger at gmail.com> wrote:

> Thanks for the reply. Well since my parser is only used to decode
> .torrent files, I think I'm safe using uint64. Also, my programming
> language doesn't support anything larger than uint64 (for the time
> being).
>
> 2010/7/21 Harold Feit <dwknight at depthstrike.com>:
> > The BEncode format considers the possibility of non-torrent applications
> > for storage. There is the potential for other applications to need
> > negative values to be stored as integers.
> >
> > Unsigned integers of varying lengths are possible, even beyond 64-bit.
> > Be prepared to adjust accordingy.
> >
> > On 21/07/2010 1:04 PM, Roger Pau Monné wrote:
> >> Hello,
> >>
> >> I'm sorry to bother the list with this noob question, but I've read at
> >> http://wiki.theory.org/BitTorrentSpecification that integers in
> >> bittorrent metainfo bencoded files (.torrent) can be 64bit signed
> >> integers, why are they signed? Since it's only used for piece lenght,
> >> number of pieces... It is correct to treat them as 64bit unsigned
> >> integers? Or I am missing something.
> >>
> >> Thanks for the help, Roger
> >> _______________________________________________
> >> BitTorrent mailing list
> >> BitTorrent at lists.ibiblio.org
> >> http://lists.ibiblio.org/mailman/listinfo/bittorrent
> >>
> >>
> >
> _______________________________________________
> BitTorrent mailing list
> BitTorrent at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/bittorrent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ibiblio.org/pipermail/bittorrent/attachments/20100722/0cf6dde7/attachment.html 


More information about the BitTorrent mailing list