Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6D428200BF4 for ; Fri, 23 Dec 2016 03:02:38 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 69F57160B27; Fri, 23 Dec 2016 02:02:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B1CC6160B26 for ; Fri, 23 Dec 2016 03:02:37 +0100 (CET) Received: (qmail 71185 invoked by uid 500); 23 Dec 2016 02:02:36 -0000 Mailing-List: contact dev-help@apex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.apache.org Delivered-To: mailing list dev@apex.apache.org Received: (qmail 71169 invoked by uid 99); 23 Dec 2016 02:02:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Dec 2016 02:02:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2111EC1125 for ; Fri, 23 Dec 2016 02:02:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.779 X-Spam-Level: * X-Spam-Status: No, score=1.779 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=datatorrent-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id U7xHz5Wchdm8 for ; Fri, 23 Dec 2016 02:02:34 +0000 (UTC) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id E4E9E5F47A for ; Fri, 23 Dec 2016 02:02:33 +0000 (UTC) Received: by mail-it0-f51.google.com with SMTP id x2so94296907itf.1 for ; Thu, 22 Dec 2016 18:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datatorrent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=fDG0hEG3xK9XnOl3HAl1GKRK6GcZLg5D24FJOaO1ggI=; b=cBMC3aopp4vSpcV71pzxnbE1T4zDrqo8b9OEiuqUSTYLKCUiN2V/QvNVvXztWZzt1R QzHqwPWRX9AEPEyGv1j4A+dLd3rJGN0v+axjK/mv136BpOGG3rZTLpv9IKwv4HnNpZIP BPxfL+m2QVtiPb3PfD7NiUuiMjnnjJHF+2G92UCR0pxOYJRLgpKm91ZqUXAuHQ3g8s1F 5N8TtxMz/6jtPFMNLw1L3GrdhJZLrFVg0KLdGSl/R1++sEzCeRW46avjYEQoEPy+IciO xq0F4yVjfo7hXLWj7Y/fpQUm6IITNG1E8NKFiyO+3jKhblwCPt86HWUtY5Ht9cxyBia6 p/2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=fDG0hEG3xK9XnOl3HAl1GKRK6GcZLg5D24FJOaO1ggI=; b=CjFENB+qZFhxFhzmanUEmlu67TTmAGcHYENDVXfp7UFi8yI7Xh4+noJA8GQc7aAM5y dLvfzLMOABOMrArJ1VmLvU8lLKUNL0bAOLQAxx/VgWGfAm2yNWFC0fLM/sx5kR1LpNf2 97xIoELkX7gwh1iLkgjpYRk6fS8KowqUqw5tfjVCroI+iAeYxYSTO7YFHzdX0lOvnUS9 MRIrs0cvs1yF/Alz8n1bc34t6baDg8kHnj2KtSjep+Q45oSbzE9trZiY5exN2oGeusmD WEfRubB/5GKmaDBZMQyPcryvoqfIt2SPDFVDNsHPalVDO4dNozpwEujEP45Z1WJos6b9 auNw== X-Gm-Message-State: AIkVDXL5bVtiqmile7+q2LtK2jCLaN4uTfacvqKovQfkSLSLnf6j/BFM9Os/8vctv7BcBYlXNQHWxQUoAJHvcjr/ X-Received: by 10.36.204.9 with SMTP id x9mr14693231itf.123.1482458553243; Thu, 22 Dec 2016 18:02:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.8.208 with HTTP; Thu, 22 Dec 2016 18:02:32 -0800 (PST) In-Reply-To: References: From: Munagala Ramanath Date: Thu, 22 Dec 2016 18:02:32 -0800 Message-ID: Subject: Re: Infinite loop in CircularBuffer constructor (corner case) To: dev@apex.apache.org Content-Type: multipart/alternative; boundary=94eb2c05a63275edd2054449c771 archived-at: Fri, 23 Dec 2016 02:02:38 -0000 --94eb2c05a63275edd2054449c771 Content-Type: text/plain; charset=UTF-8 Actually, this will happen whenever the parameter n satisfies: 2**30 < n <= Integer.MAX_VALUE Ram On Thu, Dec 22, 2016 at 5:34 PM, Munagala Ramanath wrote: > In Netlet CircularBuffer constructor, we have an infinite loop if the > first parameter (*n*) > is *Integer.MAX_VALUE* because the loop counter left-shifts 1 till it > drops into the sign > bit at which point the value is negative and fails the loop exit test. The > next left shift > yields 0 which, of course, stays that way forever; here is the fragment: > > * int i = 1;* > * while (i < n) {* > * i <<= 1;* > * }* > > Ram > --94eb2c05a63275edd2054449c771--