[asterisk-dev] translate.c:88 powerof: Powerof 0: No power??

Hans Petter Selasky hselasky at c2i.net
Sun Nov 19 14:03:05 MST 2006


Hi,

Does the following error indicate a channel driver error:

Nov 19 21:04:22 WARNING[20585]: translate.c:133 ast_translator_build_path: No 
translator path from unknown to unknown
Nov 19 21:16:54 WARNING[20585]: translate.c:88 powerof: Powerof 0: No power??
Nov 19 21:16:54 WARNING[20585]: translate.c:88 powerof: Powerof 0: No power??

Any hints what causes it?

I just looked at the code in translate.c, and it scared me that powerof() 
could return signed -1. What happens if "source == 0", while "dest == 1" for 
example. Then the following piece of code will lookup an invalid memory 
address, tr_matrix[-1][0]. Or will this never happen?

/*! Build a set of translators based upon the given source and destination 
formats */
struct ast_trans_pvt *ast_translator_build_path(int dest, int source)
{
        struct ast_trans_pvt *tmpr = NULL, *tmp = NULL;

        source = powerof(source);
        dest = powerof(dest);
        
        while(source != dest) {
                if (!tr_matrix[source][dest].step) {
                        /* We shouldn't have allocated any memory */
                        ast_log(LOG_WARNING, "No translator path from %s to 
%s\n", 
                                ast_getformatname(source), 
ast_getformatname(dest));
                        return NULL;
                }

--HPS


More information about the asterisk-dev mailing list