Author: markj
Date: Mon Aug 21 21:56:02 2017
New Revision: 322773
URL: https://svnweb.freebsd.org/changeset/base/322773

Log:
  Fix an off-by-two in the llquantize() action parameter validation.
  
  The aggregation created by llquantize() partitions values into buckets; the
  lower bound of the bucket containing the largest values is b^{m+1}, where
  b and m are the second and fourth parameters to the action, respectively.
  Bucket bounds are stored in a 64-bit integer, and so the llquantize()
  validation checks need to verify that b^{m+1} fits in 64 bits. However, it
  was only verifying that b^{m-1} fits in 64 bits, so certain parameter
  combinations could trigger assertion failures in libdtrace.
  
  PR:           219451
  MFC after:    1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Mon Aug 21 
21:48:24 2017        (r322772)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Mon Aug 21 
21:56:02 2017        (r322773)
@@ -1503,7 +1503,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra
                            "divide a power of the factor\n");
                }
 
-               for (i = 0, order = 1; i < args[2].value; i++) {
+               for (i = 0, order = 1; i <= args[2].value + 1; i++) {
                        if (order * args[0].value > order) {
                                order *= args[0].value;
                                continue;
@@ -1511,7 +1511,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra
 
                        dnerror(dnp, D_LLQUANT_MAGTOOBIG, "llquantize( ) "
                            "factor (%d) raised to power of high magnitude "
-                           "(%d) overflows 64-bits\n", args[0].value,
+                           "(%d) plus 1 overflows 64-bits\n", args[0].value,
                            args[2].value);
                }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to